Python tkinter.Checkbutton() Examples
The following are 30
code examples of tkinter.Checkbutton().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.
Example #1
Source File: labelSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 7 votes |
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) gridFrame = self._nametowidget(parent.winfo_parent()) self.parent = self._nametowidget(gridFrame.winfo_parent()) self.grid(row="0", column="0", sticky="ew") self.columnconfigure(0,weight=1) self.singleLabel = singleLabel = tk.Label(self, text=title) singleLabel.grid(row="0",column="0", sticky="ew") self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0) listbox.delete(0,tk.END) listbox.insert(0,decimalPlaces) listbox.grid(row="0", column="1") checkboxValue = tk.IntVar() checkboxValue.set(inThousands) self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0) checkbox.var = checkboxValue checkbox.grid(row="0", column="2") singleLabel.bind("<Button-1>", lambda e:self.dragStart(e, listbox, checkbox))
Example #2
Source File: _backend_tk.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = Tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = Tk.IntVar() b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #3
Source File: gui.py From snn_toolbox with MIT License | 6 votes |
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)
Example #4
Source File: _backend_tk.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = Tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = Tk.IntVar() b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #5
Source File: gui_widgets.py From SVPV with MIT License | 6 votes |
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)
Example #6
Source File: _backend_tk.py From coffeegrindsize with MIT License | 6 votes |
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = Tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = Tk.IntVar() b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #7
Source File: _backend_tk.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = tk.IntVar() b = tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=tk.LEFT) return b
Example #8
Source File: arduino_basics.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_widgets(self, **kwargs): """ Widgets shown: - The frame's title, - The checkbutton to enable/disable displaying, - The textbox. """ self.top_frame = tk.Frame(self) tk.Label(self.top_frame, text=kwargs.get('title', '')).grid(row=0, column=0) tk.Checkbutton(self.top_frame, variable=self.enabled_checkbox, text="Display?").grid(row=0, column=1) self.serial_monitor = tk.Text(self, relief="sunken", height=int(self.total_width / 10), width=int(self.total_width), font=tkFont.Font(size=kwargs.get("fontsize", 13))) self.top_frame.grid(row=0) self.serial_monitor.grid(row=1)
Example #9
Source File: cameraConfig.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_infos(self): self.info_frame = tk.Frame() self.info_frame.grid(row=0,column=1) self.fps_label = tk.Label(self.info_frame,text="fps:") self.fps_label.pack() self.auto_range = tk.IntVar() self.range_check = tk.Checkbutton(self.info_frame, text="Auto range",variable=self.auto_range) self.range_check.pack() self.auto_apply = tk.IntVar() self.auto_apply_check = tk.Checkbutton(self.info_frame, text="Auto apply",variable=self.auto_apply) self.auto_apply_check.pack() self.minmax_label = tk.Label(self.info_frame,text="min: max:") self.minmax_label.pack() self.range_label = tk.Label(self.info_frame,text="range:") self.range_label.pack() self.bits_label = tk.Label(self.info_frame,text="detected bits:") self.bits_label.pack() self.zoom_label = tk.Label(self.info_frame,text="Zoom: 100%") self.zoom_label.pack() self.reticle_label = tk.Label(self.info_frame,text="Y:0 X:0 V=0") self.reticle_label.pack()
Example #10
Source File: detailSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, mainWindow, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.mainWindow = mainWindow self.columnconfigure(1, weight=1) tk.Frame(self, height="20", width="10").grid(row="0", column="1", columnspan="2") checkboxValue = tk.BooleanVar() checkboxValue.set(settings.detailsWindowShow) self.windowDisabled = tk.Checkbutton(self, text="Show Pilot Breakdown window", variable=checkboxValue) self.windowDisabled.var = checkboxValue self.windowDisabled.grid(row="1", column="1", columnspan="2") tk.Frame(self, height="20", width="10").grid(row="2", column="1", columnspan="2") self.makeListBox()
Example #11
Source File: _backend_tk.py From CogAlg with MIT License | 6 votes |
def _Button(self, text, image_file, toggle, frame): if image_file is not None: im = tk.PhotoImage(master=self, file=image_file) else: im = None if not toggle: b = tk.Button(master=frame, text=text, padx=2, pady=2, image=im, command=lambda: self._button_click(text)) else: # There is a bug in tkinter included in some python 3.6 versions # that without this variable, produces a "visual" toggling of # other near checkbuttons # https://bugs.python.org/issue29402 # https://bugs.python.org/issue25684 var = tk.IntVar() b = tk.Checkbutton(master=frame, text=text, padx=2, pady=2, image=im, indicatoron=False, command=lambda: self._button_click(text), variable=var) b._ntimage = im b.pack(side=tk.LEFT) return b
Example #12
Source File: plugin_view.py From rabbitVE with GNU General Public License v3.0 | 6 votes |
def render_boolearn(self, info): y = (len(self.register_params) + 1) * 40 self.y_ = y + 40 name = info["name"] label = tk.Label(self, text=name.replace("_", " ") + " :", font=(None, 10)) label.place(x=0, y=y) check = tk.IntVar() check_button = tk.Checkbutton(self, text="{} ?".format(name), variable=check, onvalue=1, offvalue=0, height=4, width=10, font=(None, 10)) x = len(name) * 10 check_button.place(x=x, y=y - 20) if info.get("default", None): check.set(1) else: check.set(0) self.register_params[name] = (check, info["type"])
Example #13
Source File: tkui.py From onmyoji_bot with GNU General Public License v3.0 | 6 votes |
def create_advance(self): ''' 高级菜单 ''' advance = tk.LabelFrame(self.main_frame1, text='高级选项') advance.pack(padx=5, pady=5, fill=tk.X, side=tk.BOTTOM) tk.Checkbutton(advance, text='调试模式', variable=self.debug_enable).pack(anchor=tk.W) tk.Checkbutton(advance, text='超时自动关闭阴阳师', variable=self.watchdog_enable).pack(anchor=tk.W) frame = tk.Frame(advance) frame.pack(anchor=tk.W) tk.Label(frame, text=' 画面超时时间(秒):').grid(row=0, column=0) tk.Entry(frame, textvariable=self.max_win_time, width=5).grid(row=0, column=1) tk.Label(frame, text=' 操作超时时间(秒):').grid(row=1, column=0) tk.Entry(frame, textvariable=self.max_op_time, width=5).grid(row=1, column=1)
Example #14
Source File: ULDO02.py From mcculw with MIT License | 5 votes |
def create_widgets(self): '''Create the tkinter UI''' if self.port != None: main_frame = tk.Frame(self) main_frame.pack(fill=tk.X, anchor=tk.NW) curr_row = 0 bit_values_frame = tk.Frame(main_frame) bit_values_frame.grid(row=curr_row, column=0, padx=3, pady=3) label = tk.Label(bit_values_frame, text="Bit Number:") label.grid(row=0, column=0, sticky=tk.W) label = tk.Label(bit_values_frame, text="State:") label.grid(row=1, column=0, sticky=tk.W) # Create Checkbutton controls for each bit self.bit_checkbutton_vars = [] max_bit = min(self.port.num_bits, 8) for bit_num in range(0, max_bit): bit_label = tk.Label(bit_values_frame, text=str(bit_num)) bit_label.grid(row=0, column=bit_num + 1) var = IntVar(value=-1) bit_checkbutton = tk.Checkbutton( bit_values_frame, tristatevalue=-1, variable=var, borderwidth=0, command=lambda n=bit_num: self.bit_checkbutton_changed(n)) bit_checkbutton.grid(row=1, column=bit_num + 1, padx=(5, 0)) self.bit_checkbutton_vars.append(var) button_frame = tk.Frame(self) button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE) quit_button = tk.Button(button_frame) quit_button["text"] = "Quit" quit_button["command"] = self.exit quit_button.grid(row=0, column=0, padx=3, pady=3) else: self.create_unsupported_widgets(self.board_num)
Example #15
Source File: test_widgets.py From ironpython3 with Apache License 2.0 | 5 votes |
def create(self, **kwargs): return tkinter.Checkbutton(self.root, **kwargs)
Example #16
Source File: run_gui.py From margipose with Apache License 2.0 | 5 votes |
def _make_global_toolbar(self, master): toolbar = tk.Frame(master, bd=1, relief=tk.RAISED) def add_label(text): opts = dict(text=text) if isinstance(text, str) else dict(textvariable=text) label = tk.Label(toolbar, **opts) label.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2) return label add_label('Example index:') txt_cur_example = tk.Spinbox( toolbar, textvariable=self.var_cur_example, command=self.on_change_example, wrap=True, from_=0, to=len(self.dataset) - 1, font=tk.font.Font(size=12)) def on_key_cur_example(event): if event.keysym == 'Return': self.on_change_example() txt_cur_example.bind('<Key>', on_key_cur_example) txt_cur_example.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2) if self.model is not None: add_label('MPJPE:') add_label(self.var_mpjpe) add_label('PCK@150mm:') add_label(self.var_pck) chk_aligned = tk.Checkbutton( toolbar, text='Procrustes alignment', variable=self.var_aligned, command=lambda: self.update_current_tab()) chk_aligned.pack(side=tk.LEFT, fill=tk.Y, padx=2, pady=2) return toolbar
Example #17
Source File: log_window.py From clai with MIT License | 5 votes |
def add_toolbar(self, window): toolbar = tk.Frame(window, bd=1, relief=tk.RAISED) self.autoscroll_button = tk.Checkbutton(toolbar, text="Auto Scroll", relief=tk.SOLID, var=self.autoscroll_enable) self.autoscroll_button.pack(pady=5) toolbar.pack(side=tk.TOP, fill=tk.X)
Example #18
Source File: GUI_Complexity_end_tab3_multiple_notebooks.py From Python-GUI-Programming-Cookbook-Third-Edition with MIT License | 5 votes |
def display_tab2(): monty2 = ttk.LabelFrame(display_area, text=' Holy Grail ') monty2.grid(column=0, row=0, padx=8, pady=4) # Creating three checkbuttons chVarDis = tk.IntVar() check1 = tk.Checkbutton(monty2, text="Disabled", variable=chVarDis, state='disabled') check1.select() check1.grid(column=0, row=0, sticky=tk.W) chVarUn = tk.IntVar() check2 = tk.Checkbutton(monty2, text="UnChecked", variable=chVarUn) check2.deselect() check2.grid(column=1, row=0, sticky=tk.W ) chVarEn = tk.IntVar() check3 = tk.Checkbutton(monty2, text="Toggle", variable=chVarEn) check3.deselect() check3.grid(column=2, row=0, sticky=tk.W) # Create a container to hold labels labelsFrame = ttk.LabelFrame(monty2, text=' Labels in a Frame ') labelsFrame.grid(column=0, row=7) # Place labels into the container element - vertically ttk.Label(labelsFrame, text="Label1").grid(column=0, row=0) ttk.Label(labelsFrame, text="Label2").grid(column=0, row=1) # Add some space around each label for child in labelsFrame.winfo_children(): child.grid_configure(padx=8) #------------------------------------------
Example #19
Source File: gui.py From SVPV with MIT License | 5 votes |
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)
Example #20
Source File: keyboard_gui.py From synthesizer with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, master, gui): super().__init__(master, text="output: Echo / Delay") self.input_enabled = tk.BooleanVar() self.input_after = tk.DoubleVar() self.input_after.set(0.00) self.input_amount = tk.IntVar() self.input_amount.set(6) self.input_delay = tk.DoubleVar() self.input_delay.set(0.2) self.input_decay = tk.DoubleVar() self.input_decay.set(0.7) row = 0 tk.Label(self, text="enable?").grid(row=row, column=0) tk.Checkbutton(self, variable=self.input_enabled, selectcolor=self.cget('bg'), fg=self.cget('fg'))\ .grid(row=row, column=1, sticky=tk.W) row += 1 tk.Label(self, text="after").grid(row=row, column=0, sticky=tk.E) tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_after, from_=0, to=2.0, resolution=.01, width=10, length=120).grid(row=row, column=1) row += 1 tk.Label(self, text="amount").grid(row=row, column=0, sticky=tk.E) tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_amount, from_=1, to=10, resolution=1, width=10, length=120).grid(row=row, column=1) row += 1 tk.Label(self, text="delay").grid(row=row, column=0, sticky=tk.E) tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_delay, from_=0.0, to=0.5, resolution=.01, width=10, length=120).grid(row=row, column=1) row += 1 tk.Label(self, text="decay").grid(row=row, column=0, sticky=tk.E) tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_decay, from_=0.1, to=1.5, resolution=.1, width=10, length=120).grid(row=row, column=1)
Example #21
Source File: gui.py From snn_toolbox with MIT License | 5 votes |
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)
Example #22
Source File: graph.py From lections_2019 with GNU General Public License v3.0 | 5 votes |
def checkbox(_text, _x, _y, **kwargs): def _setChecked(self, value): self.var.set(value) print('set', value) kwargs["bg"] = kwargs.get("bg", "white") cbx = tkinter.Checkbutton( _win, text = _text, **kwargs ) cbx.var = tkinter.IntVar() cbx["variable"] = cbx.var tkinter.Checkbutton.checked = property( lambda x: x.var.get(), _setChecked ) _x, _y = transformCoord(_x, _y) cbx.place(x = _x, y = _y) return cbx #----------------------------------
Example #23
Source File: graph.py From lections_2019 with GNU General Public License v3.0 | 5 votes |
def checkbox(_text, _x, _y, **kwargs): def _setChecked(self, value): self.var.set(value) print('set', value) kwargs["bg"] = kwargs.get("bg", "white") cbx = tkinter.Checkbutton( _win, text = _text, **kwargs ) cbx.var = tkinter.IntVar() cbx["variable"] = cbx.var tkinter.Checkbutton.checked = property( lambda x: x.var.get(), _setChecked ) _x, _y = transformCoord(_x, _y) cbx.place(x = _x, y = _y) return cbx #----------------------------------
Example #24
Source File: data_logger.py From frc-characterization with Apache License 2.0 | 5 votes |
def injectGUIElements(self): # Add an extra checkbox to the top frame Label(self.STATE.topFrame, text="Angular Mode:", anchor="e").grid( row=1, column=3, sticky="ew" ) timestampEnabled = Checkbutton( self.STATE.topFrame, variable=self.STATE.angular_mode ) timestampEnabled.grid(row=1, column=4)
Example #25
Source File: chapter1_08.py From Tkinter-GUI-Application-Development-Cookbook with MIT License | 5 votes |
def __init__(self): super().__init__() self.var = tk.IntVar() self.cb = tk.Checkbutton(self, text="Active?", variable=self.var, command=self.print_value) self.cb.pack()
Example #26
Source File: test_widgets.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def create(self, **kwargs): return tkinter.Checkbutton(self.root, **kwargs)
Example #27
Source File: Percolator.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def _percolator(parent): # htest # import tkinter as tk import re class Tracer(Delegator): def __init__(self, name): self.name = name Delegator.__init__(self, None) def insert(self, *args): print(self.name, ": insert", args) self.delegate.insert(*args) def delete(self, *args): print(self.name, ": delete", args) self.delegate.delete(*args) box = tk.Toplevel(parent) box.title("Test Percolator") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) box.geometry("+%d+%d" % (x, y + 150)) text = tk.Text(box) p = Percolator(text) pin = p.insertfilter pout = p.removefilter t1 = Tracer("t1") t2 = Tracer("t2") def toggle1(): (pin if var1.get() else pout)(t1) def toggle2(): (pin if var2.get() else pout)(t2) text.pack() var1 = tk.IntVar() cb1 = tk.Checkbutton(box, text="Tracer1", command=toggle1, variable=var1) cb1.pack() var2 = tk.IntVar() cb2 = tk.Checkbutton(box, text="Tracer2", command=toggle2, variable=var2) cb2.pack()
Example #28
Source File: chartparser_app.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
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')
Example #29
Source File: test_widgets.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def create(self, **kwargs): return tkinter.Checkbutton(self.root, **kwargs)
Example #30
Source File: widgets.py From tk_tools with MIT License | 5 votes |
def __init__(self, parent, callback: callable = None, **options): self._parent = parent super().__init__(self._parent) self._var = tk.BooleanVar() self._cb = tk.Checkbutton(self, variable=self._var, **options) self._cb.grid() if callback is not None: def internal_callback(*args): try: callback() except TypeError: callback(self.get()) self._var.trace('w', internal_callback)