本文整理汇总了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)
示例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)
示例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