本文整理汇总了Python中Tkinter.Checkbutton方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.Checkbutton方法的具体用法?Python Tkinter.Checkbutton怎么用?Python Tkinter.Checkbutton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.Checkbutton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def __init__(self, parent, label, status, show, *args, **options):
conf = IGMConfig(config_file='config/igm_alt_config.v3.ini', user_config_file=['config/user_igm_alt_config.v3.ini', 'config/user_igm_alt_config.v2.ini'])
tk.Frame.__init__(self, parent, *args, **options)
fg = conf.rgb("status", "body")
bg = conf.rgb("status", "fill")
self.tk_setPalette(background=bg, foreground=fg, activeBackground=conf.rgb("status", "active_bg"), activeForeground=conf.rgb("status", "active_fg"))
self.show = show
self.title_frame = tk.Frame(self)
self.title_frame.pack(fill="x", expand=1)
ttk.Separator(self.title_frame, orient=tk.HORIZONTAL).pack(fill="x", expand=1)
tk.Label(self.title_frame, text=label, foreground=conf.rgb("status", "label")).pack(side="left", fill="x", expand=0, anchor="w")
self.status_ui = ttkHyperlinkLabel.HyperlinkLabel(self.title_frame, textvariable=status, foreground=fg, background=bg)
self.status_ui.pack(side="left", fill="x", expand=0, anchor="w")
self.toggle_button = tk.Checkbutton(self.title_frame, width=2, text='+', command=self.toggle,
variable=self.show, foreground=conf.rgb("status", "check"))
self.toggle_button.pack(side="right", expand=1, anchor="e")
self.sub_frame = tk.Frame(self, relief="flat", borderwidth=0)
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [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: edit_experimental_settings
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def edit_experimental_settings(self):
"""Settings menu for experimental features."""
self.experimental_settings_container = tk.Toplevel(bg='white')
self.experimental_settings_container.geometry('300x400')
self.experimental_settings_container.wm_title('Experimental settings')
self.experimental_settings_container.protocol(
'WM_DELETE_WINDOW', self.experimental_settings_container.destroy)
tk.Button(self.experimental_settings_container, text='Save and close',
command=self.experimental_settings_container.destroy).pack()
experimental_settings_cb = tk.Checkbutton(
self.experimental_settings_container,
text="Enable experimental settings",
variable=self.settings['experimental_settings'],
height=2, width=20, bg='white')
experimental_settings_cb.pack(expand=True)
tip = dedent("""Enable experimental settings.""")
ToolTip(experimental_settings_cb, text=tip, wraplength=750)
示例4: build_coldwn_gui_table
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def build_coldwn_gui_table(self,*event):
for element in self.column_down_gui_list:
element.destroy()
del self.column_down_gui_list[:]
for i,col in enumerate(self.column_down_inputs):
b = tk.Entry(self.coldwn_info_tab,textvariable=col[0], width=12, state=tk.DISABLED)
b.grid(row=i+2,column=1)
c = tk.Entry(self.coldwn_info_tab,textvariable=col[1], width=8)
c.grid(row=i+2,column=2)
d = tk.Entry(self.coldwn_info_tab,textvariable=col[2], width=8)
d.grid(row=i+2,column=3)
e = tk.Entry(self.coldwn_info_tab,textvariable=col[3], width=8)
e.grid(row=i+2,column=4)
f = tk.Entry(self.coldwn_info_tab,textvariable=col[4], width=8)
f.grid(row=i+2,column=5)
g = tk.Checkbutton(self.coldwn_info_tab,variable=col[5])
g.grid(row=i+2,column=6)
h = tk.Checkbutton(self.coldwn_info_tab,variable=col[6])
h.grid(row=i+2,column=7)
self.column_down_gui_list.extend([b,c,d,e,f,g,h])
示例5: initial_simulator
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def initial_simulator(self):
root = Tk()
root.title("GPIO Simulator")
previous = Button(root, text="Previous", command=self.previous)
main = Button(root, text="Main button", command=self.main)
next = Button(root, text="Next", command=self.next)
vol_up = Button(root, text="Vol +", command=self.vol_up)
vol_up_long = Button(root, text="Vol + long", command=self.vol_up_long)
vol_down = Button(root, text="Vol -", command=self.vol_down)
vol_down_long = Button(root, text="Vol - long",
command=self.vol_down_long)
main_long = Button(root, text="Main long", command=self.main_long)
self.playing_led = Checkbutton(text="playing_led", state=DISABLED)
vol_up.grid(row=0, column=1)
vol_up_long.grid(row=0, column=2)
previous.grid(row=1, column=0)
main.grid(row=1, column=1)
main_long.grid(row=1, column=2)
next.grid(row=1, column=3)
vol_down.grid(row=2, column=1)
vol_down_long.grid(row=2, column=2)
self.playing_led.grid(row=3, column=1)
root.mainloop()
示例6: _init_rulelabel
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def _init_rulelabel(self, parent):
ruletxt = 'Last edge generated by:'
self._rulelabel1 = Tkinter.Label(parent,text=ruletxt,
font=self._boldfont)
self._rulelabel2 = Tkinter.Label(parent, width=40,
relief='groove', anchor='w',
font=self._boldfont)
self._rulelabel1.pack(side='left')
self._rulelabel2.pack(side='left')
step = Tkinter.Checkbutton(parent, variable=self._step,
text='Step')
step.pack(side='right')
示例7: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def __init__(self, master=None, **kw):
if platform == 'darwin':
kw['foreground'] = kw.pop('foreground', PAGEFG)
kw['background'] = kw.pop('background', PAGEBG)
tk.Checkbutton.__init__(self, master, **kw)
elif platform == 'win32':
ttk.Checkbutton.__init__(self, master, style='nb.TCheckbutton', **kw)
else:
ttk.Checkbutton.__init__(self, master, **kw)
示例8: create
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def create(self, **kwargs):
return tkinter.Checkbutton(self.root, **kwargs)
示例9: set_check_boxes
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def set_check_boxes(self):
for gt in self.gts:
self.checkVars.append(tk.IntVar(value=0))
self.CBs.append(tk.Checkbutton(self, text=gt, variable=self.checkVars[-1], onvalue=1, offvalue=0))
self.CBs[-1].grid(row = self.r, column=self.c, sticky=tk.EW)
self.c += 1
示例10: setup_static_features
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def setup_static_features(self):
self.wm_title("SVPV - Structural Variant Prediction Viewer")
self.window_size()
if self.buttons_1:
self.buttons_1.destroy()
self.buttons_1 = tk.LabelFrame(self)
if self.reset:
self.reset.destroy()
self.reset = tk.Button(self.buttons_1, text="Reset Filters", command=self.reset_filters)
self.reset.grid(row=0, column=0, padx=40, sticky=tk.W)
if self.list:
self.list.destroy()
self.list = tk.Button(self.buttons_1, text="Apply Filters", command=self.apply_filters)
self.list.grid(row=0, column=1, padx=40, sticky=tk.E)
self.buttons_1.grid(row=4, column=0, columnspan=2, sticky=tk.EW, padx=10)
if self.buttons_2:
self.buttons_2.destroy()
self.buttons_2 = tk.LabelFrame(self)
if self.viewGTs:
self.viewGTs.destroy()
self.viewGTs = tk.Button(self.buttons_2, text="Get Genotypes", command=self.view_gts)
self.viewGTs.grid(row=0, column=0, padx=25, sticky=tk.W)
if self.viewSV:
self.viewSV.destroy()
self.viewSV = tk.Button(self.buttons_2, text="Plot Selected SV", command=self.plot_sv)
self.viewSV.grid(row=0, column=1, padx=25, sticky=tk.W)
if self.plotAll:
self.plotAll.destroy()
self.plotAll = tk.Button(self.buttons_2, text="Plot All SVs", command=self.plot_all)
self.plotAll.grid(row=0, column=2, padx=25, sticky=tk.E)
if self.display_cb:
self.display_cb.destroy()
self.display_var = tk.IntVar(value=1)
self.display_cb = tk.Checkbutton(self.buttons_2, text='display plot on creation', variable=self.display_var,
onvalue=1, offvalue=0)
self.display_cb.grid(row=1, column=1, padx=25, sticky=tk.E)
self.buttons_2.grid(row=6, column=0, columnspan=2, sticky=tk.EW, padx=10)
示例11: select_plots_dir_rb
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def select_plots_dir_rb(self):
"""Select plots directory."""
self.plot_dir_frame = tk.LabelFrame(self.graph_frame, labelanchor='nw',
text="Select dir", relief='raised',
borderwidth='3', bg='white')
self.plot_dir_frame.pack(side='top', fill=None, expand=False)
self.gui_log.set(os.path.join(self.settings['path_wd'].get(),
'log', 'gui'))
if os.path.isdir(self.gui_log.get()):
plot_dirs = [d for d in sorted(os.listdir(self.gui_log.get()))
if os.path.isdir(os.path.join(self.gui_log.get(), d))]
self.selected_plots_dir = tk.StringVar(value=plot_dirs[0])
[tk.Radiobutton(self.plot_dir_frame, bg='white', text=name,
value=name, command=self.select_layer_rb,
variable=self.selected_plots_dir).pack(
fill='both', side='bottom', expand=True)
for name in plot_dirs]
open_new_cb = tk.Checkbutton(self.graph_frame, bg='white', height=2,
width=20, text='open in new window',
variable=self.settings['open_new'])
open_new_cb.pack(**self.kwargs)
tip = dedent("""\
If unchecked, the window showing graphs for a certain layer will
close and be replaced each time you select a layer to plot.
If checked, an additional window will pop up instead.""")
ToolTip(open_new_cb, text=tip, wraplength=750)
示例12: build_colup_gui_table
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def build_colup_gui_table(self,*event):
for element in self.column_up_gui_list:
element.destroy()
del self.column_up_gui_list[:]
for i,col in enumerate(self.column_up_inputs):
a = tk.Checkbutton(self.colup_info_tab,variable=col[0])
a.grid(row=i+2,column=1)
b = tk.Entry(self.colup_info_tab,textvariable=col[1], width=12, state=tk.DISABLED)
b.grid(row=i+2,column=2)
c = tk.Entry(self.colup_info_tab,textvariable=col[2], width=8)
c.grid(row=i+2,column=3)
d = tk.Entry(self.colup_info_tab,textvariable=col[3], width=8)
d.grid(row=i+2,column=4)
e = tk.Entry(self.colup_info_tab,textvariable=col[4], width=8)
e.grid(row=i+2,column=5)
f = tk.Entry(self.colup_info_tab,textvariable=col[5], width=8)
f.grid(row=i+2,column=6)
g = tk.Checkbutton(self.colup_info_tab,variable=col[6])
g.grid(row=i+2,column=7)
h = tk.Checkbutton(self.colup_info_tab,variable=col[7])
h.grid(row=i+2,column=8)
self.column_up_gui_list.extend([a,b,c,d,e,f,g,h])
示例13: build_loads_gui
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def build_loads_gui(self, *event):
#Destroy all the individual tkinter gui elements for the current applied loads
for load_gui in self.loads_gui:
for gui_element in load_gui:
gui_element.destroy()
#Delete all the elements in the List containing the gui elements
del self.loads_gui[:]
del self.loads_scale[:]
n = 0
for loads in self.loads_gui_select_var:
load_types = ['Point','Moment','UDL','TRAP']
load_locals = ['Left','Center','Right']
if loads[6].get() == 'Moment':
self.loads_scale.append(float(loads[1].get())/2.0)
else:
self.loads_scale.append(float(loads[1].get()))
self.loads_scale.append(float(loads[2].get()))
self.loads_gui.append([
tk.Checkbutton(self.loads_frame, variable=loads[0], command = self.build_loads),
tk.Entry(self.loads_frame, textvariable=loads[1], width=15),
tk.Entry(self.loads_frame, textvariable=loads[2], width=15),
tk.Entry(self.loads_frame, textvariable=loads[3], width=15),
tk.Entry(self.loads_frame, textvariable=loads[4], width=15),
tk.OptionMenu(self.loads_frame, loads[5], *load_locals),
tk.OptionMenu(self.loads_frame, loads[6], *load_types)])
self.loads_gui[n][0].grid(row=n+1, column=1)
self.loads_gui[n][1].grid(row=n+1, column=2, padx = 4)
self.loads_gui[n][2].grid(row=n+1, column=3, padx = 4)
self.loads_gui[n][3].grid(row=n+1, column=4, padx = 4)
self.loads_gui[n][4].grid(row=n+1, column=5, padx = 4)
self.loads_gui[n][5].grid(row=n+1, column=6)
self.loads_gui[n][6].grid(row=n+1, column=7)
n+=1
示例14: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def __init__(self, master):
tk.Frame.__init__(self, master)
self.pack()
self.var1 = tk.IntVar()
self.var2 = tk.IntVar()
tk.Label(self, text="These are checkbuttons").pack()
tk.Checkbutton(self, text='Pick me!', variable=self.var1, command=self.checked).pack()
tk.Checkbutton(self, text='Or pick me!', variable=self.var2, command=self.checked).pack()
tk.Button(self, text='OK', command=self.ok).pack()
开发者ID:brysontyrrell,项目名称:MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter,代码行数:16,代码来源:Tkinter_Widget_Examples.py
示例15: ok
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Checkbutton [as 别名]
def ok(self):
print('Checkbutton 1: {}\nCheckbutton 2: {}'.format(self.var1.get(), self.var2.get()))
开发者ID:brysontyrrell,项目名称:MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter,代码行数:4,代码来源:Tkinter_Widget_Examples.py