当前位置: 首页>>代码示例>>Python>>正文


Python Window.shrink_wrap方法代码示例

本文整理汇总了Python中GUI.Window.shrink_wrap方法的典型用法代码示例。如果您正苦于以下问题:Python Window.shrink_wrap方法的具体用法?Python Window.shrink_wrap怎么用?Python Window.shrink_wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GUI.Window的用法示例。


在下文中一共展示了Window.shrink_wrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def main():
    f = None
    args = sys.argv[1:]
    if args:
        fontsize = int(args[0])
        sf = StdFonts.system_font
        f = Font(sf.family, fontsize, sf.style)
        #showfont("Using font", f)
    win = Window(title = "Heights")
    if f:
        kwds = {'font': f}
    else:
        kwds = {}
    controls = [
        Label(text = "Label", **kwds),
        TextField(text = "Text", **kwds),
        CheckBox(title = "Check", **kwds),
        RadioButton(title = "Radio", **kwds),
        Slider(orient = 'h', width = 50),
        #Button(title = "Button", **kwds),
    ]
    #for ctl in controls:
    #	say("Height of %r is %s" % (ctl, ctl.height))
    win.place_row(controls, left = 10, top = 10)
    win.shrink_wrap(padding = (10, 10))
    win.show()
    run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:29,代码来源:32-default-heights.py

示例2: main

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def main():
    win = Window()
    view = PolyView(width=120, height=120)
    win.add(view)
    win.shrink_wrap()
    win.show()
    application().run()
开发者ID:rceballos98,项目名称:hapticJacket,代码行数:9,代码来源:27-poly.py

示例3: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    view = TestView(size = (300, 200))
    win = Window(title = "Coloured Text")
    win.add(view)
    win.shrink_wrap()
    win.show()
    run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:9,代码来源:34-coloured-text.py

示例4: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    win = Window(title = "Exceptions", size = (200, 100))
    but1 = Button("ApplicationError", action = raise_application_error)
    but2 = Button("Exception", action = raise_exception)
    win.place_column([but1, but2], left = 20, top = 20)
    win.shrink_wrap(padding = (20, 20))
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:10,代码来源:18-exceptions.py

示例5: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    view = GearsView(size = (300, 300))
    win = Window(title = "Gears")
    win.place(view, sticky = "nsew")
    view.become_target()
    win.shrink_wrap()
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:10,代码来源:91-glview-task.py

示例6: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    starter = Button("Start", action = start_task)
    stopper = Button("Stop", action = stop_task)
    win = Window(title = "Tasks")
    win.place_column([starter, stopper], left = 20, top = 20, spacing = 20)
    win.shrink_wrap(padding = (20, 20))
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:10,代码来源:24-task.py

示例7: main

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def main():
    view = CTV(size=(200, 300))
    win = Window(title="Canvas")
    win.add(view)
    win.shrink_wrap()
    view.become_target()
    win.show()
    app = application()
    app.menus = basic_menus() + [test_menu]
    app.run()
开发者ID:rceballos98,项目名称:hapticJacket,代码行数:12,代码来源:31-canvas.py

示例8: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    cursor = StdCursors.finger
    win = Window(title = "Cursor", width = 500, height = 400)
    view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
    view2 = TestScrollableView(position = (140, 20), size = (200, 200),
        scrolling = 'hv')
    view2.cursor = cursor
    win.add(view1)
    win.place(view2, sticky = 'nsew')
    win.shrink_wrap((20, 20))
    win.show()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:13,代码来源:13-cursor.py

示例9: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    win = Window(title = "Frame")
    frm = Frame()
    frm.place_column([
        Label("This is"),
        Label("A frame")],
        left = 0, top = 0)
    frm.shrink_wrap()
    win.place(frm, left = 30, top = 30)
    win.shrink_wrap(padding = (30, 30))
    win.show()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:13,代码来源:30-frame.py

示例10: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    app = application()
    pixmap = GLPixmap(50, 50, double_buffer = False, alpha = False)
    pixmap.with_context(draw_triangle, flush = True)
    #pixmap.with_canvas(draw_circle)
    view = PixmapTestView(pixmap, size = (180, 200))
    win = Window(title = "GLPixmap", resizable = False)
    win.add(view)
    win.shrink_wrap()
    win.show()
    app.run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:13,代码来源:92-glpixmap.py

示例11: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    file = "grail_masked.tiff"
    # file = "spam_masked.tiff"
    image = Image(os.path.join(sys.path[0], file))
    cursor = Cursor(image)
    win = Window(title="Image Cursor", width=500, height=400)
    view1 = TestDrawing(position=(20, 20), size=(100, 70), cursor=cursor)
    view2 = TestScrollableView(position=(140, 20), size=(200, 200), scrolling="hv")
    view2.cursor = cursor
    win.add(view1)
    win.place(view2, sticky="nsew")
    win.shrink_wrap((20, 20))
    win.show()
开发者ID:rceballos98,项目名称:hapticJacket,代码行数:15,代码来源:37-image-cursor.py

示例12: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    def bing():
        say("Bing!")
        #fld._win_dump_flags()
    win = Window(title = "Shrink Wrap", resizable = 0)
    but = Button("Bing!", action = bing)
    cbx = CheckBox("Spam")
    fld = TextField(width = 100)
    win.place(but, left = 20, top = 20)
    win.place(cbx, left = but + 20, top = 20)
    win.place(fld, left = 20, top = but + 20)
    win.shrink_wrap()
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:16,代码来源:23-shrink_wrap.py

示例13: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test():
    def select():
        i = group.value
        name = cursor_names[i]
        say("Selecting cursor no. %d (%s)" % (i, name))
        cursor = getattr(StdCursors, name)
        say("...", cursor)
        view.cursor = cursor
    win = Window(title = "Std Cursors")
    view = TestArea(size = (100, 100))
    win.place(view, left = 20, top = 20)
    group = RadioGroup(action = select)
    for i, name in enumerate(cursor_names):
        group.add_item(RadioButton(title = name, value = i))
    win.place_column(group, left = view + 20, top = 20, spacing = 0)
    win.shrink_wrap((20, 20))
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:20,代码来源:28-std-cursors.py

示例14: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
def test(orient, pos, pad):
    win = Window(title = "%s Sliders" % orient.upper(), position = pos,
        auto_position = False)
    sliders = []
    if 1:
        #say("Creating slider 1")
        sl1 = sl2 = sl3 = None
        sl1 = Slider(orient = orient, max_value = 100)
        sl1.action = slid(sl1, orient, 1)
        sliders.append(sl1)
    if 1:
        #say("Creating slider 2")
        sl2 = Slider(orient = orient, max_value = 100, ticks = 6, live = False)
        sl2.value = 50
        sl2.action = slid(sl2, orient, 2)
        sliders.append(sl2)
    if 1:
        #say("Creating slider 3")
        sl3 = Slider(orient = orient, max_value = 100, ticks = 6, discrete = True)
        sl3.value = 100
        sl3.action = slid(sl3, orient, 3)
        sliders.append(sl3)
    #say("Created sliders")
    if orient == 'h':
        win.place_column(sliders, left = 20, top = 20, spacing = 20, sticky = 'ew')
        if sl2:
            sl2.vstretch = True
        if sl3:
            sl3.vmove = True
    else:
        win.place_row(sliders, left = 20, top = 20, spacing = 20, sticky = 'ns')
        if sl2:
            sl2.hstretch = True
        if sl3:
            sl3.hmove = True
    #say("Placed sliders")
    win.shrink_wrap()
    win.show()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:40,代码来源:29-slider.py

示例15: make_row

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import shrink_wrap [as 别名]
for align in ['t', 'c', 'b']:
    row = make_row(align)
    rows.append([row, "align = '%s'" % align])

row = Row([Button("Buckle"), Button("My"), Button("Shoe")],
    equalize = 'w')
rows.append([row, "equalize = 'w'"])

y = 50
for row, title in rows:
    row.position = (10, 10)
    row.anchor = 'ltrb'
    win = Window(title = title, position = (10, y),
        auto_position = False)
    win.add(row)
    win.shrink_wrap()
    win.show()
    y = win.bottom + 50

instructions = """
Check that the text field in the first three rows expands horizontally
when the window is resized.

Check that the components in the third row are anchored to the bottom
of the window.

The buttons in the fourth row should all be the same width.
"""

say(instructions)
app = application()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:33,代码来源:40-row.py


注:本文中的GUI.Window.shrink_wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。