本文整理汇总了Python中tkinter.SINGLE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.SINGLE属性的具体用法?Python tkinter.SINGLE怎么用?Python tkinter.SINGLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.SINGLE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SINGLE [as 别名]
def __init__(self, master, **kw):
kw['selectmode'] = tk.SINGLE
kw['activestyle'] = 'none'
kw['height'] = '0'
tk.Listbox.__init__(self, master, kw)
self.bind('<Button-1>', self.setCurrent)
self.bind('<B1-Motion>', self.shiftSelection)
self.curIndex = None
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SINGLE [as 别名]
def __init__(self, master, name, **kwargs):
tk.Frame.__init__(self, master, **kwargs)
self.name = name
# Get list of available modules
self.modules_list = mi.get_submodule_list()
self.modules_list.sort()
self.modules_list.remove('SettingsGUI')
self.modules_list.insert(0,'SettingsGUI')
self.modules_list.remove('CPACSUpdater')
self.modules_list.remove('WorkflowCreator')
self.modules_list.remove('utils')
try:
self.modules_list.remove('WKDIR')
except:
log.info('No WKDIR yet.')
self.selected_list = []
row_pos = 0
if name == 'Optim':
label_optim = tk.Label(self, text='Optimisation method')
label_optim.grid(column=0, row=0, columnspan=1,pady=10)
# The Combobox is directly use as the varaible
optim_choice = ['None', 'DoE', 'Optim']
self.optim_choice_CB = ttk.Combobox(self, values=optim_choice, width=15)
self.optim_choice_CB.grid(column=4, row=row_pos)
row_pos += 1
# ListBox with all available modules
tk.Label(self, text='Available modules').grid(column=0, row=row_pos, pady=5)
self.LB_modules = tk.Listbox(self, selectmode=tk.SINGLE, width=25, height=len(self.modules_list))
item_count = len(self.modules_list)
self.LB_modules.grid(column=0, row=row_pos+1, columnspan=3, rowspan=15, padx=10, pady=3)
for item in self.modules_list:
self.LB_modules.insert(tk.END, item)
# Button
addButton = tk.Button(self, text=' Add > ', command=self._add)
addButton.grid(column=4, row=row_pos+1)
removeButton = tk.Button(self, text='< Remove', command=self._remove)
removeButton.grid(column=4, row=row_pos+2)
upButton = tk.Button(self, text=' Up ^ ', command=self._up)
upButton.grid(column=4, row=row_pos+3)
downButton = tk.Button(self, text=' Down v ', command=self._down)
downButton.grid(column=4, row=row_pos+4)
# ListBox with all selected modules
tk.Label(self, text='Selected modules').grid(column=5, row=row_pos)
self.LB_selected = tk.Listbox(self, selectmode=tk.SINGLE, width=25, height=len(self.modules_list))
self.LB_selected.grid(column=5, row=row_pos+1, columnspan=3, rowspan=15, padx=10, pady=3)
for item in self.selected_list:
self.LB_selected.insert(tk.END, item)
row_pos += (item_count + 1)
示例3: init_gui
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SINGLE [as 别名]
def init_gui(self):
"""Builds GUI."""
self.root.title('AnkiMaker')
self.grid(column=0, row=0, sticky='nsew')
lists_width = 10
# Loaders frame
loader_list = [loaders.KindleLoader,
loaders.FileLoader,
loaders.OEDLoader,
loaders.WikLoader]
self.loaders = []
for l in loader_list:
# initialize every loader's frame with the mainframe as parent
self.loaders.append(l(self))
# Loaders list
self.list = tkinter.Listbox(self, width = lists_width,
height = 8,
selectmode = tkinter.SINGLE)
self.list.grid(column=0, row=0, sticky = 'N')
for op in self.loaders:
self.list.insert(tkinter.END, op.name)
self.list.bind('<<ListboxSelect>>', self.select)
self.list.selection_set(0)
# Deck creation frame
self.dframe = DeckFrame(self)
self.dframe.grid(column=0, row=1, columnspan = 4)
self.dframe.disable()
# Add padding to everything
for child in self.winfo_children():
child.grid_configure(padx=5, pady=5)
self.select()