本文整理汇总了Python中Tkinter.Spinbox方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.Spinbox方法的具体用法?Python Tkinter.Spinbox怎么用?Python Tkinter.Spinbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.Spinbox方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_slider
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Spinbox [as 别名]
def _make_slider(self, parent, rowidx, label, inival, maxval, res=0.5):
# Create shared variable and set initial value.
tkvar = tk.DoubleVar()
tkvar.set(inival)
# Set a callback for whenever tkvar is changed.
# (The 'command' callback on the SpinBox only applies to the buttons.)
tkvar.trace('w', self._update_callback)
# Create the Label, SpinBox, and Scale objects.
label = tk.Label(parent, text=label)
spbox = tk.Spinbox(parent,
textvariable=tkvar,
from_=0, to=maxval, increment=res)
slide = tk.Scale(parent,
orient=tk.HORIZONTAL,
showvalue=0,
variable=tkvar,
from_=0, to=maxval, resolution=res)
label.grid(row=rowidx, column=0)
spbox.grid(row=rowidx, column=1)
slide.grid(row=rowidx, column=2)
return tkvar
# Find the largest output size that fits within the given bounds and
# matches the aspect ratio of the original source image.
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Spinbox [as 别名]
def __init__(self, parent):
tk.LabelFrame.__init__(self, parent)
self.title = tk.Label(self, text='SV Length')
self.len_GT_On = tk.IntVar(value=0)
self.len_GT_On_CB = tk.Checkbutton(self, text=">", justify=tk.LEFT, variable=self.len_GT_On)
self.len_GT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.len_LT_On = tk.IntVar(value=0)
self.len_LT_On_CB = tk.Checkbutton(self, text="<", justify=tk.LEFT, variable=self.len_LT_On)
self.len_LT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.title.grid(row=0, column=0, sticky=tk.EW, columnspan=4)
self.len_GT_On_CB.grid(row=1, column=0, sticky=tk.EW)
self.len_GT_val.grid(row=2, column=0, sticky=tk.EW)
self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW)
self.len_LT_On_CB.grid(row=1, column=2, sticky=tk.EW)
self.len_LT_val.grid(row=2, column=2, sticky=tk.EW)
self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW)
示例3: create
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Spinbox [as 别名]
def create(self, **kwargs):
return tkinter.Spinbox(self.root, **kwargs)
示例4: reset
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Spinbox [as 别名]
def reset(self):
self.len_GT_On.set(0)
self.len_LT_On.set(0)
self.len_GT_val.destroy()
self.len_GT_Units.destroy()
self.len_LT_val.destroy()
self.len_LT_Units.destroy()
self.len_GT_val = tk.Spinbox(self, values=(1, 5, 10, 50, 100, 500), width=3)
self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.len_LT_val = tk.Spinbox(self, values=(1, 5, 10, 50, 100, 500), width=3)
self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)
self.len_GT_val.grid(row=2, column=0, sticky=tk.EW)
self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW)
self.len_LT_val.grid(row=2, column=2, sticky=tk.EW)
self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW)
示例5: setUpClass
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Spinbox [as 别名]
def setUpClass(cls):
requires('gui')
cls.root = root = tk.Tk()
PyShell.fix_x11_paste(root)
cls.text = tk.Text(root)
cls.entry = tk.Entry(root)
cls.spin = tk.Spinbox(root)
root.clipboard_clear()
root.clipboard_append('two')