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


Python Window.add方法代码示例

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


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

示例1: main

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [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

示例2: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
def test():
    cursor = StdCursors.empty_cursor()
    win = Window(title = "No Cursor", width = 500, height = 400)
    view = TestDrawing(position = (20, 20), size = (300, 200),
        cursor = cursor)
    win.add(view)
    win.show()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:9,代码来源:36-no-cursor.py

示例3: make_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
def make_window():
    win = Window(size = (240, 100), title = "Password")
    tf = TextField(position = (20, 20), width = 200, password = True)
    ok = Button("OK", position = (20, 60),	action = (show, tf))
    win.add(tf)
    win.add(ok)
    win.show()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:9,代码来源:25-password.py

示例4: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [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

示例5: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
def test():
    win = Window(title = "Targeting", size = (180, 100))
    patch1 = TestPatch("Red patch", red, position = (20, 20))
    patch2 = TestPatch("Green patch", green, position = (100, 20))
    win.add(patch1)
    win.add(patch2)
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:10,代码来源:26-targeting.py

示例6: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
def test():
    doc = TestDoc(title = "Document")
    view = TestDocView(model = doc, size = (200, 200))
    win = Window(resizable = 0, size = (200, 200))
    win.add(view)
    win.document = doc
    #say(view.x, view.y, view.width, view.height)
    win.show()
    application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:11,代码来源:20-document.py

示例7: main

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [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 add [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 add [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

示例10: test

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [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

示例11: open_pick_formation_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]

#.........这里部分代码省略.........
    win_pick_formation.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_pick_formation.size)

    # ========== Title ==========
    title = Label(text=pick_formation_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_pick_formation.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    general_display.append(title)

    # ========== Button Functions ==========
    def formation_btn_func(formation):
        win_pick_formation.become_target()
        AssignPlayers.open_assign_players_window(win_pick_formation.x, win_pick_formation.y,
                                                 db_dict, formation, win_pick_formation)
        win_pick_formation.hide()

    def formation_list_btn_func():
        generic_formation = {"style": "Generic",
                             "name": "Generic",
                             "description": "Generic formation for picking players to be used with list of formations.",
                             "num_links": 17,
                             "num_defenders": 4,
                             "num_midfielders": 4,
                             "num_attackers": 2,
                             "positions": {
                                 "11": {"index": 0, "symbol": "11", "name": "Spot 11", "links": []},
                                 "10": {"index": 1, "symbol": "10", "name": "Spot 10", "links": []},
                                 "9": {"index": 2, "symbol": "9", "name": "Spot 9", "links": []},
                                 "8": {"index": 3, "symbol": "8", "name": "Spot 8", "links": []},
                                 "7": {"index": 4, "symbol": "7", "name": "Spot 7", "links": []},
                                 "6": {"index": 5, "symbol": "6", "name": "Spot 6", "links": []},
                                 "5": {"index": 6, "symbol": "5", "name": "Spot 5", "links": []},
                                 "4": {"index": 7, "symbol": "4", "name": "Spot 4", "links": []},
                                 "3": {"index": 8, "symbol": "3", "name": "Spot 3", "links": []},
                                 "2": {"index": 9, "symbol": "2", "name": "Spot 2", "links": []},
                                 "1": {"index": 10, "symbol": "1", "name": "Spot 1", "links": []}}}
        win_pick_formation.become_target()
        AssignPlayers.open_assign_players_window(win_pick_formation.x, win_pick_formation.y,
                                                 db_dict, generic_formation, win_pick_formation)
        win_pick_formation.hide()

    def back_btn_func():
        win_pick_formation.become_target()
        win_previous.show()
        win_pick_formation.hide()

    # ========== Formation Button Declarations ==========
    formation_button_width = 200
    msg_y = title.bottom

    # Sort DB so it is consistent
    db_dict['formation_db'][1].sort(['name'])

    for formation in db_dict['formation_db'][1].db:
        formation_btn = Button(title=formation['name'],
                                  font=std_tf_font,
                                  width=formation_button_width, height=std_tf_height,
                                  x=(win_pick_formation.width - formation_button_width)/2, y=msg_y,
                                  action=(formation_btn_func, formation))
        general_display.append(formation_btn)

        msg_y += std_tf_height + 1

    msg_y += 9

    formation_list_btn = Button(title='Use Formation List',
                                font=std_tf_font,
                                width=formation_button_width, height=std_tf_height,
                                x=(win_pick_formation.width - formation_button_width)/2, y=msg_y,
                                action=formation_list_btn_func)
    general_display.append(formation_list_btn)

    msg_y += std_tf_height + 10

    back_btn = Button('Back',
                      font=std_tf_font_bold,
                      width=button_width, height=button_height,
                      x=(win_pick_formation.width - button_width)/2, y=msg_y,
                      action=back_btn_func)
    general_display.append(back_btn)

    # ========== Add buttons to window ==========
    for item in general_display:
        view.add(item)

    win_pick_formation.add(view)
    view.become_target()
    win_pick_formation.show()
开发者ID:mcspen,项目名称:FIFA,代码行数:104,代码来源:PickFormation.py

示例12: offset_rect

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
        c.backcolor = skyblue
        c.erase_rect(r)
        main_image_pos = (50, 50)
        src_rect = image.bounds
        #say("Image bounds =", src_rect)
        dst_rect = offset_rect(src_rect, main_image_pos)
        #say("Drawing", src_rect, "in", dst_rect)
        image.draw(c, src_rect, dst_rect)

import os, sys
here = sys.path[0]
image_path = os.path.join(here, "pill.png")
pil_image = Image.open(image_path)
print "PIL Image: size =", pil_image.size, "mode =", pil_image.mode
image = image_from_pil_image(pil_image)

win = Window(size = (350, 200), title = "PIL Image")
view = ImageTestView(size = win.size)
win.add(view)
view.become_target()
win.show()

instructions = """
There should be an image of a red and yellow pill on a blue background.
The background should show through transparent areas of the image, and
the edges of the non-transparent areas should be smooth.
"""

say(instructions)
application().run()
开发者ID:karlmatthew,项目名称:pygtk-craigslist,代码行数:32,代码来源:44-pil_image.py

示例13: open_search_menu

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]

#.........这里部分代码省略.........

            for attr in attr_list:
                if attributes_list.count(attr) == 0:
                    attributes_list.append(attr)

            for attr_key in attr_dict.iterkeys():
                if attributes_list.count(attr_key) == 0:
                    attributes_list.append(attr_key)

            display_teams(search_results, attributes_list, (0, num_results))

        win_search.become_target()

    def back_btn_func():
        win_search.hide()
        StartMenu.open_start_menu(win_search.x, win_search.y, db_dict)

    # ========== Search Type Button Functions ==========
    def players_btn_func():
        for btn in search_type_button_list:
            btn.enabled = 1
        players_btn.enabled = 0
        settings["mode"] = "players"

        # Reset screen
        reset_btn_func()

        view.remove(formation_db_radio_btn)
        view.remove(f_db_file_btn)
        view.remove(formation_list_radio_btn)
        view.remove(f_list_file_btn)
        view.remove(team_list_button)

        view.add(player_db_radio_btn)
        view.add(p_db_file_btn)
        view.add(player_list_radio_btn)
        view.add(p_list_file_btn)

        win_search.become_target()

    def formations_btn_func():
        for btn in search_type_button_list:
            btn.enabled = 1
        formations_btn.enabled = 0
        settings["mode"] = "formations"

        # Reset screen
        reset_btn_func()

        view.remove(player_db_radio_btn)
        view.remove(p_db_file_btn)
        view.remove(player_list_radio_btn)
        view.remove(p_list_file_btn)
        view.remove(team_list_button)

        view.add(formation_db_radio_btn)
        view.add(f_db_file_btn)
        view.add(formation_list_radio_btn)
        view.add(f_list_file_btn)

        win_search.become_target()

    def teams_btn_func():
        for btn in search_type_button_list:
            btn.enabled = 1
        teams_btn.enabled = 0
开发者ID:mcspen,项目名称:FIFA,代码行数:70,代码来源:SearchMenu.py

示例14: Button

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]
if settings.option('general', 'enableSleep'): enableSleepBox.on = True
if settings.option('general', 'verboseLogging'): verboseLoggingBox.on = True
if settings.option('tumblr', 'publishOutput'): publishOutputBox.on = True
if settings.option('tumblr', 'enablePostPreview'): enablePostPreviewBox.on = True
if settings.option('tumblr', 'enableAskReplies'): enableAskRepliesBox.on = True
if settings.option('tumblr', 'enableAskDeletion'): enableAskDeletionBox.on = True
if settings.option('tumblr', 'fetchRealAsks'): fetchRealAsksBox.on = True
if settings.option('tumblr', 'enableReblogs'): enableReblogsBox.on = True
if settings.option('tumblr', 'enableDreams'): enableDreamsBox.on = True

loopButton = Button(x=15, y=enableDreamsBox.bottom + 15, width=170, title="Start Emma Loop", style='default', action=loop_emma)
runOnceButton = Button(x=15, y=loopButton.bottom + 5, width=170, title="Run Emma Once", style='normal', action=run_emma)

win = Window(width=200, height=runOnceButton.bottom + 20, title="Emma", auto_position=True, resizable=False, zoomable=False)

win.add(generalLabel)
win.add(enableChatModeBox)
win.add(enableSleepBox)
win.add(verboseLoggingBox)

win.add(tumblrLabel)
win.add(publishOutputBox)
win.add(enablePostPreviewBox)
win.add(enableAskRepliesBox)
win.add(enableAskDeletionBox)
win.add(fetchRealAsksBox)
win.add(enableReblogsBox)
win.add(enableDreamsBox)

win.add(loopButton)
win.add(runOnceButton)
开发者ID:torakoneko,项目名称:emma,代码行数:33,代码来源:__main__.py

示例15: open_enter_text_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import add [as 别名]

#.........这里部分代码省略.........
                        download_settings['overwrite_counter'] += 1
                        message.text = "Really, really, really sure?"
                    elif download_settings['overwrite_counter'] >= 3:
                        valid_name = True

                if valid_name:
                    # Open status window to start download of players
                    StatusWindow.open_status_window(win_enter_text.x, win_enter_text.y, db_dict,
                                                    get_prices=sort_order_radio_group.value,
                                                    file_name=new_player_db_name, settings=settings,
                                                    win_previous=win_enter_text, win_next='FilesMenu')
                    win_enter_text.hide()

            else:
                message.text = "File name must be at least 1 character."

    def back_btn_func():
        if box_type == 'download':
            FilesMenu.open_files_menu(window_x, window_y, db_dict, settings)
        else:
            PickFile.open_pick_file_window(window_x, window_y, db_dict, settings)
        win_enter_text.hide()

    # ========== Buttons ==========
    enter_btn.x = (win_enter_text.width - 2*button_width - button_spacing) / 2
    enter_btn.y = win_enter_text.height - 70
    enter_btn.height = button_height
    enter_btn.width = button_width
    enter_btn.font = button_font
    enter_btn.action = enter_btn_func
    enter_btn.style = 'default'
    enter_btn.color = button_color
    enter_btn.just = 'right'
    general_display.append(enter_btn)

    back_btn.x = enter_btn.right + button_spacing
    back_btn.y = enter_btn.top
    back_btn.height = button_height
    back_btn.width = button_width
    back_btn.font = button_font
    back_btn.action = back_btn_func
    back_btn.style = 'default'
    back_btn.color = button_color
    back_btn.just = 'right'
    general_display.append(back_btn)

    # ========== Value Textfield ==========
    value_tf = TextField()
    value_tf.width = 200
    value_tf.x = (win_enter_text.width - value_tf.width) / 2
    value_tf.y = enter_btn.top - 65
    value_tf.height = 25
    value_tf.font = std_tf_font
    value_tf.value = fill_text
    general_display.append(value_tf)

    def get_attribute_sort_order_rg():
        settings['order_rg'] = sort_order_radio_group.value
        win_enter_text.become_target()

    sort_order_radio_group = RadioGroup(action=get_attribute_sort_order_rg)

    prices_label_width = 85
    prices_button_width = 50
    prices_label = Label(text="Get Prices?:", font=std_tf_font, width=prices_label_width, height=std_tf_height,
                         color=title_color)
    prices_label.x = (win_enter_text.width - 2*prices_button_width - 10 - prices_label_width) / 2
    prices_label.y = enter_btn.top - 38
    prices_label.just = 'center'

    prices_yes = RadioButton("Yes")
    prices_yes.width = prices_button_width
    prices_yes.x = prices_label.right + 5
    prices_yes.y = prices_label.top
    prices_yes.group = sort_order_radio_group
    prices_yes.value = True

    prices_no = RadioButton("No")
    prices_no.width = prices_button_width
    prices_no.x = prices_yes.right + 5
    prices_no.y = prices_label.top
    prices_no.group = sort_order_radio_group
    prices_no.value = False

    sort_order_radio_group.value = True

    if box_type == 'download':
        value_tf.y = enter_btn.top - 75

        general_display.append(prices_label)
        general_display.append(prices_yes)
        general_display.append(prices_no)

    # ========== Add buttons to window ==========
    for item in general_display:
        view.add(item)

    win_enter_text.add(view)
    view.become_target()
    win_enter_text.show()
开发者ID:mcspen,项目名称:FIFA,代码行数:104,代码来源:EnterText.py


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