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


Python Combobox.insert方法代码示例

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


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

示例1: GUI_elements

# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import insert [as 别名]
class GUI_elements(object):       # GUI objects, including those accessed
                                  # during session; initialize only once
    def __init__(self, master, app):
        self.master = master
        if app_state['exec_mode'] == 'PVS-client':
            emacs_pid = pvs_eval_and_wait('(emacs-pid)')
        else:
            emacs_pid = app_state['exec_mode']
        master.title('Hypatheon Client for PVS (%s)' % emacs_pid)
        if on_aqua: pass           # no separtor needed on OS X
        else:
            Frame(master, height=1, bg='black', bd=0
                  ).pack(fill=X, expand=YES)

        status_row = Frame(master)    # drawing info displays, control buttons
        self.status_msg, self.prover_status, self.import_status, \
            self.exec_mode_status = \
            [ Label(status_row, relief=SUNKEN, bd=1, padx=5,
                    font=text_font)
              for i in range(4) ]     # must match number of fields
        self.status_msg['text'] = 'Welcome to Hypatheon     '
        for widget in (self.status_msg, self.prover_status, self.import_status):
            widget.pack(padx=2, side=LEFT)
        Frame(status_row).pack(side=LEFT, fill=X, expand=YES)
        if on_aqua:                   # avoid resize handle on lower right
            Frame(status_row).pack(padx=10, side=RIGHT)
        self.exec_mode_status.pack(padx=2, side=RIGHT)
        status_row.pack(padx=5, pady=2, fill=X, side=BOTTOM)

        self.create_query_control_area(master)
        self.query_history = []   # collect previous queries for listbox

        if on_osx: main_geometry = '+0+40'   # upper left, with Y offset
        else:      main_geometry = '-0+0'    # upper right
        master.geometry(newGeometry=main_geometry)
        master.deiconify()

# At the top of the main window is where queries are entered and launched.
# This region contains a few Entry widgets for entering search terms
# plus the buttons needed for control.

    def create_query_control_area(self, win):
        def clear_entries():
            for ent in self.q_entries: ent.delete(0, END)
            self.q_entries[0].focus_set()
        bind_control_key(win, 'u', clear_entries)
        def invoke_query(dummy=None, terms=None, explicit_query=1):
            if terms == None:
                first = self.q_entries[0].get()
                if ';' in first:
                    packed = split_and_pad_terms(first)
                    terms = [ term.strip() for term in packed ]
                else:
                    terms = [ ent.get().strip() for ent in self.q_entries ]
            results = submit_query(terms, explicit_query)
            if not explicit_query and not results:
                return results
            for ent, term in zip(self.q_entries, terms):
                ent.delete(0, END)
                ent.insert(END, term)
            return results
        self.invoke_query_handler = \
            EventHandler('Invoke query choice', invoke_query)
        button_width = 5

        def make_bottom_right(parent):
            try:
                # If the ttk combo-box widget is available, use it for the
                # Types field.  Otherwise, create one out of other Tk widgets.
                from ttk import Combobox
                itypes = [ ' ' + t for t in cap_item_types ]
                self.type_ent = Combobox(parent, values=itypes,
                                         width=(query_entry_width - 6),
                                         height=len(itypes))
                self.ttk_type_entry = 1
                return self.type_ent
            except:
                self.ttk_type_entry = 0    # ttk not present

            bottom_right = Frame(parent)
            self.type_ent = entry_widget(bottom_right,
                                         width=(query_entry_width - 6))
            self.type_ent.pack(side=LEFT, fill=X, expand=YES)
            self.types_pulldown_button = \
                Button(bottom_right, text=u_triagdn, pady=0, anchor=S,
                       command=EventHandler('Display file type list',
                                            self.types_pull_down))
            self.types_pulldown_button.pack(side=LEFT, padx=2)
            return bottom_right

        def col_4(parent, row):
            if row == 0:
                return entry_widget(parent, width=query_entry_width)
            else:
                return make_bottom_right(parent)
        def col_6(parent, row):
            if row == 0:
                return ThinButton(parent, text='Clear', width=button_width,
                                  command=EventHandler('Clear entries',
                                                       clear_entries, 0))
#.........这里部分代码省略.........
开发者ID:E-LLP,项目名称:pvslib,代码行数:103,代码来源:hypatheon_main.py


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