本文整理匯總了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')