本文整理汇总了Python中ttk.Radiobutton方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Radiobutton方法的具体用法?Python ttk.Radiobutton怎么用?Python ttk.Radiobutton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk
的用法示例。
在下文中一共展示了ttk.Radiobutton方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: body
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs):
self.rb_fastq = ttk.Radiobutton(
master,
text="FASTQ File Mode",
variable=self.mode,
value="FASTQ",
command=self.fastq_mode,
)
self.rb_fastq.grid(row=row, column=0, columnspan=columns, sticky="ew")
self.rb_counts = ttk.Radiobutton(
master,
text="Count File Mode",
variable=self.mode,
value="Counts",
command=self.counts_mode,
)
self.rb_counts.grid(row=row + 1, column=0, columnspan=columns, sticky="ew")
return 2
示例2: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def __init__(self, master=None, **kw):
if platform == 'darwin':
kw['foreground'] = kw.pop('foreground', PAGEFG)
kw['background'] = kw.pop('background', PAGEBG)
tk.Radiobutton.__init__(self, master, **kw)
elif platform == 'win32':
ttk.Radiobutton.__init__(self, master, style='nb.TRadiobutton', **kw)
else:
ttk.Radiobutton.__init__(self, master, **kw)
示例3: test_invoke
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def test_invoke(self):
success = []
def cb_test():
success.append(1)
return "cb test called"
myvar = Tkinter.IntVar()
cbtn = ttk.Radiobutton(command=cb_test, variable=myvar, value=0)
cbtn2 = ttk.Radiobutton(command=cb_test, variable=myvar, value=1)
res = cbtn.invoke()
self.assertEqual(res, "cb test called")
self.assertEqual(cbtn['value'], myvar.get())
self.assertEqual(myvar.get(),
cbtn.tk.globalgetvar(cbtn['variable']))
self.assertTrue(success)
cbtn2['command'] = ''
res = cbtn2.invoke()
self.assertEqual(res, '')
self.assertFalse(len(success) > 1)
self.assertEqual(cbtn2['value'], myvar.get())
self.assertEqual(myvar.get(),
cbtn.tk.globalgetvar(cbtn['variable']))
self.assertEqual(str(cbtn['variable']), str(cbtn2['variable']))
示例4: create
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def create(self, **kwargs):
return ttk.Radiobutton(self.root, **kwargs)
示例5: test_invoke
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def test_invoke(self):
success = []
def cb_test():
success.append(1)
return "cb test called"
myvar = tkinter.IntVar(self.root)
cbtn = ttk.Radiobutton(self.root, command=cb_test,
variable=myvar, value=0)
cbtn2 = ttk.Radiobutton(self.root, command=cb_test,
variable=myvar, value=1)
if self.wantobjects:
conv = lambda x: x
else:
conv = int
res = cbtn.invoke()
self.assertEqual(res, "cb test called")
self.assertEqual(conv(cbtn['value']), myvar.get())
self.assertEqual(myvar.get(),
conv(cbtn.tk.globalgetvar(cbtn['variable'])))
self.assertTrue(success)
cbtn2['command'] = ''
res = cbtn2.invoke()
self.assertEqual(str(res), '')
self.assertLessEqual(len(success), 1)
self.assertEqual(conv(cbtn2['value']), myvar.get())
self.assertEqual(myvar.get(),
conv(cbtn.tk.globalgetvar(cbtn['variable'])))
self.assertEqual(str(cbtn['variable']), str(cbtn2['variable']))
示例6: body
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def body(self, master):
message = ttk.Label(master, text="SeqLib type:")
message.grid(column=0, row=0)
for i, k in enumerate(SEQLIB_LABEL_TEXT.keys()):
rb = ttk.Radiobutton(
master,
text=SEQLIB_LABEL_TEXT[k],
variable=self.element_tkstring,
value=k,
)
rb.grid(column=0, row=(i + 1), sticky="w")
if i == 0:
rb.invoke()
示例7: build_input_frame
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def build_input_frame(self):
"""
The build_input_frame method builds the interface for
the input frame
"""
# Frame Init
self.input_frame = ttk.Frame(self.root)
self.input_frame.config(padding = (30,0))
self.input_frame.pack()
# Input Value
ttk.Label(self.input_frame,
text="Enter Time Value").grid(row=0, column=0)
self.input_time = StringVar()
ttk.Entry(self.input_frame, textvariable=self.input_time,
width=25).grid(row=0, column=1, padx=5)
# Radiobuttons
self.time_type = StringVar()
self.time_type.set('raw')
ttk.Radiobutton(self.input_frame, text="Raw Value",
variable=self.time_type, value="raw").grid(row=1,
column=0, padx=5)
ttk.Radiobutton(self.input_frame, text="Formatted Value",
variable=self.time_type, value="formatted").grid(
row=1, column=1, padx=5)
# Button
ttk.Button(self.input_frame, text="Run",
command=self.convert).grid(
row=2, columnspan=2, pady=5)
开发者ID:PacktPublishing,项目名称:Learning-Python-for-Forensics-Second-Edition,代码行数:36,代码来源:date_decoder.py
示例8: body
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Radiobutton [as 别名]
def body(self, master):
row_no = self.name_tk.body(master, 0)
row_no += self.output_directory_tk.body(master, row_no)
element_types = ttk.Frame(master, padding=(3, 3, 12, 12))
element_types.grid(
column=0, row=row_no, sticky="nsew", columnspan=DEFAULT_COLUMNS
)
message = ttk.Label(element_types, text="Root object type:")
message.grid(column=0, row=0)
label = ttk.Label(element_types, text="Experiment")
label.grid(column=0, row=1, sticky="w")
rb = ttk.Radiobutton(
element_types,
text="Experiment",
variable=self.element_tkstring,
value="Experiment",
)
rb.grid(column=0, row=2, sticky="w")
rb.invoke()
label = ttk.Label(element_types, text="Selection")
label.grid(column=0, row=3, sticky="w")
rb = ttk.Radiobutton(
element_types,
text="Selection",
variable=self.element_tkstring,
value="Selection",
)
rb.grid(column=0, row=4, sticky="w")
label = ttk.Label(element_types, text="SeqLib")
label.grid(column=0, row=5, sticky="w")
for i, k in enumerate(SEQLIB_LABEL_TEXT.keys()):
rb = ttk.Radiobutton(
element_types,
text=SEQLIB_LABEL_TEXT[k],
variable=self.element_tkstring,
value=k,
)
rb.grid(column=0, row=(i + 6), sticky="w")