本文整理汇总了Python中tkinter.Toplevel.columnconfigure方法的典型用法代码示例。如果您正苦于以下问题:Python Toplevel.columnconfigure方法的具体用法?Python Toplevel.columnconfigure怎么用?Python Toplevel.columnconfigure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Toplevel
的用法示例。
在下文中一共展示了Toplevel.columnconfigure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ListDialog
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import columnconfigure [as 别名]
class ListDialog(object):
def __init__ (self, master, items, message, accept_func):
self.accept_func = accept_func
self.top = Toplevel(master)
self.top.transient(master)
self.top.rowconfigure(0, weight=1)
self.top.rowconfigure(1, weight=3)
self.top.rowconfigure(2, weight=0)
self.top.columnconfigure(0, weight=1)
self.top.columnconfigure(1, weight=1)
self.top.resizable(width=True, height=True)
self.frame = Frame(self.top)
self.frame.rowconfigure(0, weight=1)
self.frame.rowconfigure(1, weight=0)
self.frame.columnconfigure(0, weight=1)
self.frame.columnconfigure(1, weight=0)
self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2)
self.canvas = Canvas(self.frame)
self.canvas.create_text(0, 0, text=message, anchor=NW)
self.canvas.grid(row=0, column=0, sticky=(N, W, S, E))
self.vscroll = Scrollbar(self.frame, command=self.canvas.yview)
self.vscroll.grid(row=0, column=1, sticky=(N, S))
self.canvas['yscrollcommand'] = self.vscroll.set
self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL)
self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2)
self.canvas['xscrollcommand'] = self.hscroll.set
self.canvas['scrollregion'] = self.canvas.bbox('all')
self.canvas.bind('<Button-4>', self.scroll)
self.canvas.bind('<Button-5>', self.scroll)
self.canvas.bind('<MouseWheel>', self.scroll)
self.view = NameView(self.top, sorted(items))
self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S))
self.delbutton = Button(self.top, text='Ok', command=self.accept )
self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel)
self.delbutton.grid(row=2, column=0)
self.cancelbutton.grid(row=2, column=1)
self.view.widget.focus_set()
def accept(self):
self.accept_func(self.view.selection())
self.top.destroy()
def cancel(self):
self.result = None
self.top.destroy()
def scroll(self, event):
if event.num == 4 or event.delta > 0:
self.canvas.yview(SCROLL, -1, UNITS)
elif event.num == 5 or event.delta < 0:
self.canvas.yview(SCROLL, 1, UNITS)
示例2: __init__
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import columnconfigure [as 别名]
class SpeciesListDialog:
def __init__(self, parent):
self.parent = parent
self.gui = Toplevel(parent.guiRoot)
self.gui.grab_set()
self.gui.focus()
self.gui.columnconfigure(0, weight=1)
self.gui.rowconfigure(1, weight=1)
Label(self.gui, text="Registered Species:").grid(row=0, column=0, pady=5, padx=5, sticky="w")
self.listRegisteredSpecies = Listbox(self.gui, width=70)
self.buttonAdd = Button(self.gui, text=" + ")
self.buttonDel = Button(self.gui, text=" - ")
self.listRegisteredSpecies.grid(row=1, column=0, columnspan=3, sticky="nswe", pady=5, padx=5)
self.buttonAdd.grid(row=2, column=1, pady=5, padx=5)
self.buttonDel.grid(row=2, column=2, pady=5, padx=5)
# Set (minimum + max) Window size
self.gui.update()
self.gui.minsize(self.gui.winfo_width(), self.gui.winfo_height())
# self.gui.maxsize(self.gui.winfo_width(), self.gui.winfo_height())
self.actionUpdate(None)
self.gui.bind("<<Update>>", self.actionUpdate)
self.gui.protocol("WM_DELETE_WINDOW", self.actionClose)
self.buttonDel.bind("<ButtonRelease>", self.actionDel)
self.buttonAdd.bind("<ButtonRelease>", self.actionAdd)
self.gui.mainloop()
def actionClose(self):
self.parent.guiRoot.event_generate("<<Update>>", when="tail")
self.gui.destroy()
def actionUpdate(self, event):
self.listRegisteredSpecies.delete(0, "end")
for (taxid, name) in self.parent.optimizer.speciesList:
self.listRegisteredSpecies.insert("end", taxid + ": " + name)
def actionDel(self, event):
try:
selection = self.listRegisteredSpecies.selection_get()
selectionSplit = selection.split(": ")
self.parent.optimizer.speciesList.remove((selectionSplit[0], selectionSplit[1]))
self.gui.event_generate("<<Update>>")
except tkinter.TclError:
# no selection
pass
def actionAdd(self, Event):
SpeciesSearchDialog(self.parent, self)
示例3: show_stat
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import columnconfigure [as 别名]
def show_stat(self):
""" show best times """
def reset():
""" reset best times """
for level in ["easy", "medium", "difficult"]:
CONFIG.set("Statistics", level, "")
top.destroy()
if self.chrono_on:
self.play_pause()
top = Toplevel(self)
top.transient(self)
top.columnconfigure(1, weight=1)
top.resizable(0, 0)
top.title(_("Statistics"))
top.grab_set()
Label(top, text=_("Best times"), font="Sans 12 bold").grid(row=0, columnspan=2,
padx=30, pady=10)
for i, level in enumerate(["easy", "medium", "difficult"]):
Label(top, text=_(level.capitalize()),
font="Sans 10 bold").grid(row=i + 1, column=0, padx=(20, 4),
pady=4, sticky="e")
tps = CONFIG.get("Statistics", level)
if tps:
tps = int(tps)
m = tps // 60
s = tps % 60
Label(top, text=" %i min %i s" % (m, s),
font="Sans 10").grid(row=i + 1, column=1,
sticky="w", pady=4,
padx=(4, 20))
Button(top, text=_("Close"), command=top.destroy).grid(row=4, column=0, padx=(10, 4), pady=10)
Button(top, text=_("Clear"), command=reset).grid(row=4, column=1, padx=(4, 10), pady=10)