當前位置: 首頁>>代碼示例>>Python>>正文


Python tkinter.EXTENDED屬性代碼示例

本文整理匯總了Python中tkinter.EXTENDED屬性的典型用法代碼示例。如果您正苦於以下問題:Python tkinter.EXTENDED屬性的具體用法?Python tkinter.EXTENDED怎麽用?Python tkinter.EXTENDED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在tkinter的用法示例。


在下文中一共展示了tkinter.EXTENDED屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import EXTENDED [as 別名]
def __init__(self, master, items=None, selected=None, command=None, grid=None, align=None, visible=True, enabled=None, multiselect=False, width=None, height=None):

        description = "[ListBox] object"
        self._multiselect = multiselect

        # Create a tk OptionMenu object within this object
        mode = EXTENDED if multiselect else BROWSE
        # exportselection=0 allows you to select from more than 1 Listbox
        tk = Listbox(master.tk, selectmode=mode, exportselection=0)

        # Add the items
        if items is not None:
            for item in items:
                tk.insert(END, item)

        super(ListBoxWidget, self).__init__(master, tk, description, grid, align, visible, enabled, width, height)

        self.events.set_event("<ListBox.ListboxSelect>", "<<ListboxSelect>>", self._command_callback)

        # Select the selected items
        if selected is not None:
            self.value = selected

        # The command associated with this combo
        self.update_command(command) 
開發者ID:lawsie,項目名稱:guizero,代碼行數:27,代碼來源:ListBox.py

示例2: __init__

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import EXTENDED [as 別名]
def __init__(self, parent, samples, ped=None):
        tk.LabelFrame.__init__(self, parent, text="Sample Selection")
        self.parent = parent
        self.samples = samples
        self.ped = ped
        self.families = []

        if self.ped is None:
            self.flb = FieldedListbox(self, ('Sample',), width=20, selectmode=tk.EXTENDED)
            for s in self.samples:
                self.flb.push_entry((s,))
            self.flb.grid(row=0, column=0, padx=10, columnspan=2)
        else:
            self.flb = FieldedListbox(self, ('Sample', 'Family'), width=15, selectmode=tk.EXTENDED)
            for s in self.samples:
                if s in ped.families_by_sample:
                    self.families.append(ped.families_by_sample[s])
                else:
                    self.families.append('NA')
                self.flb.push_entry((s, self.families[-1]))
                self.flb.grid(row=0, column=0, padx=10, columnspan=3)

        self.select_b = tk.Button(self, text="Select", command=self.select)
        self.select_b.grid(row=1, column=0, padx=10)
        c = 1
        if ped is not None:
            self.select_fam_b = tk.Button(self, text="Select Family", command=self.select_fam)
            self.select_fam_b.grid(row=1, column=c, padx=10)
            c += 1
        self.clear = tk.Button(self, text="Clear", command=self.clear)
        self.clear.grid(row=1, column=c, padx=10) 
開發者ID:VCCRI,項目名稱:SVPV,代碼行數:33,代碼來源:gui_widgets.py

示例3: create_list_box

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import EXTENDED [as 別名]
def create_list_box(self):
        frame = tk.Frame(self.root)
        self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2',
                                   bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10)
        self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.list_box.bind(
            "<Double-Button-1>", self.on_play_list_double_clicked)
        self.list_box.bind("<Button-3>", self.show_context_menu)
        scroll_bar = tk.Scrollbar(frame)
        scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH)
        self.list_box.config(yscrollcommand=scroll_bar.set)
        scroll_bar.config(command=self.list_box.yview)
        frame.grid(row=4, padx=5, columnspan=10, sticky='ew') 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代碼行數:15,代碼來源:view.py


注:本文中的tkinter.EXTENDED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。