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: tkmktap.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def setupOptFlags(self):
        self.optFlags = []
        flags = []
        if hasattr(self.options, 'optFlags'):
            flags.extend(self.options.optFlags)

        d = {}
        soFar = {}
        for meth in reflect.prefixedMethodNames(self.options.__class__, 'opt_'):
            full = 'opt_' + meth
            func = getattr(self.options, full)

            if not usage.flagFunction(func) or meth in ('help', 'version'):
                continue
            
            if soFar.has_key(func):
                continue
            soFar[func] = 1
            
            existing = d.setdefault(func, meth)
            if existing != meth:
                if len(existing) < len(meth):
                    d[func] = meth
            
            for (func, name) in d.items():
                flags.append((name, None, func.__doc__))
            
            if len(flags):
                self.optFrame = f = Tkinter.Frame(self)
                for (flag, _, desc) in flags:
                    b = Tkinter.BooleanVar()
                    c = Tkinter.Checkbutton(f, text=desc, variable=b, wraplen=200)
                    c.pack(anchor=Tkinter.W)
                    self.optFlags.append((flag, b))
                f.grid(row=1, column=1) 
Example #2
Source File: gpio_simulator.py    From mopidy-ttsgpio with Apache License 2.0 6 votes vote down vote up
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() 
Example #3
Source File: gui_widgets.py    From SVPV with MIT License 6 votes vote down vote up
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 #4
Source File: gui.py    From snn_toolbox with MIT License 6 votes vote down vote up
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 #5
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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]) 
Example #6
Source File: Frame_2D_GUI_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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]) 
Example #7
Source File: simple_beam_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 
Example #8
Source File: chooser.py    From crazyswarm with MIT License 5 votes vote down vote up
def __init__(self, parent, name):
			Tkinter.Frame.__init__(self, parent)
			self.checked = Tkinter.BooleanVar()
			checkbox = Tkinter.Checkbutton(self, variable=self.checked, command=save,
				padx=0, pady=0)
			checkbox.grid(row=0, column=0, sticky='E')
			nameLabel = Tkinter.Label(self, text=name, padx=0, pady=0)
			nameLabel.grid(row=0, column=1, sticky='W')
			self.batteryLabel = Tkinter.Label(self, text="", fg="#999999", padx=0, pady=0)
			self.batteryLabel.grid(row=1, column=0, columnspan=2, sticky='E')
			self.versionLabel = Tkinter.Label(self, text="", fg="#999999", padx=0, pady=0)
			self.versionLabel.grid(row=2, column=0, columnspan=2, sticky='E')

	# construct all the checkboxes 
Example #9
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Checkbutton(self.root, **kwargs) 
Example #10
Source File: base_dialog.py    From PCWG with MIT License 5 votes vote down vote up
def addCheckBox(self, master, title, value):

        label = tk.Label(master, text=title)
        label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)
        variable = tk.IntVar(master, value)

        checkButton = tk.Checkbutton(master, variable=variable)
        checkButton.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

        self.row += 1

        return variable 
Example #11
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addCheckBox(self, master, title, value):

            label = tk.Label(master, text=title)
            label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)
            variable = tk.IntVar(master, value)

            checkButton = tk.Checkbutton(master, variable=variable)
            checkButton.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

            self.row += 1

            return variable 
Example #12
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def ok(self):
        print('Checkbutton 1: {}\nCheckbutton 2: {}'.format(self.var1.get(), self.var2.get())) 
Example #13
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
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() 
Example #14
Source File: chartparser_app.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
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 #15
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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]) 
Example #16
Source File: chart.py    From razzy-spinner with GNU General Public License v3.0 5 votes vote down vote up
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 #17
Source File: Frame_2D_GUI_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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]) 
Example #18
Source File: gui.py    From snn_toolbox with MIT License 5 votes vote down vote up
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 #19
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
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: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent)
        self.af_on = tk.IntVar(value=0)
        self.af_on_cb = tk.Checkbutton(self, text="AF Threshold", variable=self.af_on)
        self.af_on_cb.grid(row=0, column=0, padx=3, columnspan=2, sticky=tk.EW)
        self.af_var = tk.DoubleVar()
        self.af_gt_lt = tk.IntVar(value=1)
        self.af_lt_radio_button = tk.Radiobutton(self, text="<", variable=self.af_gt_lt, value=1)
        self.af_lt_radio_button.grid(row=1, column=0, sticky=tk.EW)
        self.af_gt_radio_button = tk.Radiobutton(self, text=">", variable=self.af_gt_lt, value=2)
        self.af_gt_radio_button.grid(row=1, column=1, sticky=tk.EW)

        self.af_scale = tk.Scale(self, variable=self.af_var, from_=float(0), to=float(1), resolution=float(0.01),
                                 orient=tk.HORIZONTAL)
        self.af_scale.grid(row=2, column=0, padx=3, sticky=tk.EW, columnspan=2) 
Example #21
Source File: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent)
        self.ref_gene_on = tk.IntVar(value=0)
        self.ref_gene_on_cb = tk.Checkbutton(self, text="ref gene\nintersection", justify=tk.LEFT, variable=self.ref_gene_on)
        self.ref_gene_on_cb.grid(row=0, column=0, sticky=tk.W)

        self.gene_list_on = tk.IntVar(value=0)
        self.gene_list_on_cb = tk.Checkbutton(self, text="gene list\nintersection", justify=tk.LEFT, variable=self.gene_list_on)
        self.gene_list_on_cb.grid(row=1, column=0, sticky=tk.W)

        self.exonic_on = tk.IntVar(value=0)
        self.exonic_on_cb = tk.Checkbutton(self, text="exonic", justify=tk.LEFT, variable=self.exonic_on)
        self.exonic_on_cb.grid(row=2, column=0, sticky=tk.W) 
Example #22
Source File: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
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 
Example #23
Source File: edrtogglingpanel.py    From edr with Apache License 2.0 5 votes vote down vote up
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) 
Example #24
Source File: test_widgets.py    From oss-ftp with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Checkbutton(self.root, **kwargs) 
Example #25
Source File: myNotebook.py    From EDMarketConnector with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #26
Source File: welds_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def loads_base_material_input_gui(self):
        tk.Label(self.tab_loads, text="** All Loads Assumed to Act at the Weld Group Centroid**", font=self.f_type_b_big).grid(row=0,column=0,columnspan=6, sticky = tk.W)
        tk.Label(self.tab_loads, text="Loading:", font=self.f_type_b).grid(row=1,column=0, sticky = tk.W)
        tk.Label(self.tab_loads, text="Materials:", font=self.f_type_b).grid(row=1,column=3, sticky = tk.W)
        
        load_labels = ['Fz (lbs)= \nAxial', 'Fx (lbs)= \nShear X', 'Fy (lbs)= \nShear Y', 'Mx (in-lbs)= \nMoment About X', 'My (in-lbs)= \nMoment About Y', 'Mz = (in-lbs)\nMoment About Z']
        self.loads_in = [tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar()]
        
        for load in self.loads_in:
            load.set('0.00')
        
        i=0
        for label, load in zip(load_labels, self.loads_in):
            current_load_row_count = 2+i
            tk.Label(self.tab_loads, text=label, font=self.f_type, justify=tk.RIGHT).grid(row=current_load_row_count,column=0, sticky = tk.E)
            tk.Entry(self.tab_loads, textvariable=load, width=20).grid(row=current_load_row_count,column=1, sticky = tk.W)
            i+=1
            
        material_labels = ['Fexx,weld (ksi)= ','Fy,base 1 (ksi) = ','Fu,base 1 (ksi)= ','t,base 1 (in) = ','Fy,base 2 (ksi) = ','Fu,base 2 (ksi)= ','t,base 2 (in) = ']
        self.material_in = [tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar()]
        
        default_material = ['70.00','36.00','58.00','0.375','36.00','58.00','0.375']
        for material, default in zip(self.material_in, default_material):
            material.set(default)
        
        y=0
        for material_label, material in zip(material_labels,self.material_in):
            current_material_row_count = 2+y
            tk.Label(self.tab_loads, text=material_label, font=self.f_type, justify=tk.RIGHT).grid(row=current_material_row_count,column=3, sticky = tk.E)
            tk.Entry(self.tab_loads, textvariable=material, width=15).grid(row=current_material_row_count,column=4, sticky = tk.W)
            y+=1
        
        self.run_analysis_button = tk.Button(self.tab_loads,text = "Run Analysis (Quadrant)", command = self.force_analysis, font=self.f_type_b)
        self.run_analysis_button.grid(row=current_load_row_count+1, column=0, columnspan=2, pady=10)
        
        self.run_analysis_segment_button = tk.Button(self.tab_loads,text = "Run Analysis (Segment)", command = self.force_analysis_segment, font=self.f_type_b)
        self.run_analysis_segment_button.grid(row=current_load_row_count+2, column=0, columnspan=2, pady=10)
        
        self.run_analysis_conservative_button = tk.Button(self.tab_loads,text = "Run Analysis (Conservative)", command = self.force_analysis_conservative, font=self.f_type_b)
        self.run_analysis_conservative_button.grid(row=current_load_row_count+3, column=0, columnspan=2, pady=10)
        
        self.design_asd = tk.IntVar()
        tk.Checkbutton(self.tab_loads , text=' : Loads are Nominal (ASD)', variable=self.design_asd, font=self.f_type_b).grid(row=current_material_row_count+1, column=4, sticky = tk.W)
        
        self.run_design_button = tk.Button(self.tab_loads,text = "Run AISC Design", command = self.aisc_design, font=self.f_type_b)
        self.run_design_button.grid(row=current_material_row_count+2, column=3, columnspan=2, pady=10) 
Example #27
Source File: tkgui.py    From ATX with Apache License 2.0 4 votes vote down vote up
def _init_items(self):
        """
        .---------------.
        | Ctrl | Screen |
        |------|        |
        | Code |        |
        |      |        |
        """
        root = self._root
        root.resizable(0, 0)

        frm_control = tk.Frame(root, bg='#bbb')
        frm_control.grid(column=0, row=0, padx=5, sticky=tk.NW)
        frm_screen = tk.Frame(root, bg='#aaa')
        frm_screen.grid(column=1, row=0)

        frm_screenshot = tk.Frame(frm_control)
        frm_screenshot.grid(column=0, row=0, sticky=tk.W)
        tk.Label(frm_control, text='-'*30).grid(column=0, row=1, sticky=tk.EW)
        frm_code = tk.Frame(frm_control)
        frm_code.grid(column=0, row=2, sticky=tk.EW)

        self._btn_refresh = tk.Button(frm_screenshot, textvariable=self._refresh_text, command=self._refresh_screen)
        self._btn_refresh.grid(column=0, row=0, sticky=tk.W)
        # tk.Button(frm_screenshot, text="Wakeup", command=self._device.wakeup).grid(column=0, row=1, sticky=tk.W)
        tk.Button(frm_screenshot, text=u"保存选中区域", command=self._save_crop).grid(column=0, row=1, sticky=tk.W)
        
        # tk.Button(frm_screenshot, text="保存截屏", command=self._save_screenshot).grid(column=0, row=2, sticky=tk.W)
        frm_checkbtns = tk.Frame(frm_screenshot)
        frm_checkbtns.grid(column=0, row=3, sticky=(tk.W, tk.E))
        tk.Checkbutton(frm_checkbtns, text="Auto refresh", variable=self._auto_refresh_var, command=self._run_check_refresh).grid(column=0, row=0, sticky=tk.W)
        tk.Checkbutton(frm_checkbtns, text="UI detect", variable=self._uiauto_detect_var).grid(column=1, row=0, sticky=tk.W)

        frm_code_editor = tk.Frame(frm_code)
        frm_code_editor.grid(column=0, row=0, sticky=(tk.W, tk.E))
        tk.Label(frm_code_editor, text='Generated code').grid(column=0, row=0, sticky=tk.W)
        tk.Entry(frm_code_editor, textvariable=self._gencode_text, width=30).grid(column=0, row=1, sticky=tk.W)
        tk.Label(frm_code_editor, text='Save file name').grid(column=0, row=2, sticky=tk.W)
        tk.Entry(frm_code_editor, textvariable=self._genfile_name, width=30).grid(column=0, row=3, sticky=tk.W)
        tk.Label(frm_code_editor, text='Extention name').grid(column=0, row=4, sticky=tk.W)
        tk.Entry(frm_code_editor, textvariable=self._fileext_text, width=30).grid(column=0, row=5, sticky=tk.W)
        
        frm_code_btns = tk.Frame(frm_code)
        frm_code_btns.grid(column=0, row=2, sticky=(tk.W, tk.E))
        tk.Button(frm_code_btns, text='Run', command=self._run_code).grid(column=0, row=0, sticky=tk.W)
        self._btn_runedit = tk.Button(frm_code_btns, state=tk.DISABLED, text='Insert and Run', command=self._run_and_insert)
        self._btn_runedit.grid(column=1, row=0, sticky=tk.W)
        tk.Button(frm_code, text='Select File', command=self._run_selectfile).grid(column=0, row=4, sticky=tk.W)
        tk.Label(frm_code, textvariable=self._attachfile_text).grid(column=0, row=5, sticky=tk.W)
        tk.Button(frm_code, text='Reset', command=self._reset).grid(column=0, row=6, sticky=tk.W)

        self.canvas = tk.Canvas(frm_screen, bg="blue", bd=0, highlightthickness=0, relief='ridge')
        self.canvas.grid(column=0, row=0, padx=10, pady=10)
        self.canvas.bind("<Button-1>", self._stroke_start)
        self.canvas.bind("<B1-Motion>", self._stroke_move)
        self.canvas.bind("<B1-ButtonRelease>", self._stroke_done)
        self.canvas.bind("<Motion>", self._mouse_move) 
Example #28
Source File: Percolator.py    From Splunking-Crime with GNU Affero General Public License v3.0 4 votes vote down vote up
def _percolator(parent):
    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)
    root = tk.Tk()
    root.title("Test Percolator")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    text = tk.Text(root)
    p = Percolator(text)
    t1 = Tracer("t1")
    t2 = Tracer("t2")

    def toggle1():
        if var1.get() == 0:
            var1.set(1)
            p.insertfilter(t1)
        elif var1.get() == 1:
            var1.set(0)
            p.removefilter(t1)

    def toggle2():
        if var2.get() == 0:
            var2.set(1)
            p.insertfilter(t2)
        elif var2.get() == 1:
            var2.set(0)
            p.removefilter(t2)

    text.pack()
    var1 = tk.IntVar()
    cb1 = tk.Checkbutton(root, text="Tracer1", command=toggle1, variable=var1)
    cb1.pack()
    var2 = tk.IntVar()
    cb2 = tk.Checkbutton(root, text="Tracer2", command=toggle2, variable=var2)
    cb2.pack() 
Example #29
Source File: Select.py    From PyKinectTk with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self):

        # init

        self._root = tk.Tk()

        # Load initial data from database

        self._db = Database(DATABASE)
        
        tbl_PerformanceName = self._db[PERFORMANCE_NAME_TABLE]
        tbl_AudioPath       = self._db[AUDIO_PATH_TABLE]

        # Create widget to display selector
        self._listbox = tk.Listbox(self._root)
        self._listbox.pack()
        self._performances = []
        for i, name in tbl_PerformanceName:
            self._listbox.insert(tk.END, name)
            self._performances.append(i)

        # Add Audio Button
        self._addAudio = tk.Button(self._root, text="Add Audio Files", command=self.add_audio)
        self._addAudio.pack()

        # Playback Button
        self._playback = tk.Button(self._root, text="Play", command=self.start_playback)
        self._playback.pack()

        # Save to video Button
        self._toVideo = tk.Button(self._root, text="Save as Video", command=self.to_video)
        self._toVideo.pack()

        # Radio buttons for selecting stream to play/store
        self._streams = {}
        self._streams['body']  = tk.IntVar(value=1)
        self._streams['video'] = tk.IntVar(value=1)
        self._streams['audio'] = tk.IntVar(value=0)
        self._streams['depth'] = tk.IntVar(value=0)

        for stream in self._streams:
            button = tk.Checkbutton(self._root,
                                    text=stream,
                                    variable=self._streams[stream],
                                    offvalue=False,
                                    onvalue=True,
                                    anchor=tk.W)
            button.pack()        

        # Location of videos
        self._video_fp_root = "%s.avi"

        # Run
        self._root.mainloop() 
Example #30
Source File: Percolator.py    From oss-ftp with MIT License 4 votes vote down vote up
def _percolator(parent):
    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)
    root = tk.Tk()
    root.title("Test Percolator")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))
    text = tk.Text(root)
    p = Percolator(text)
    t1 = Tracer("t1")
    t2 = Tracer("t2")

    def toggle1():
        if var1.get() == 0:
            var1.set(1)
            p.insertfilter(t1)
        elif var1.get() == 1:
            var1.set(0)
            p.removefilter(t1)

    def toggle2():
        if var2.get() == 0:
            var2.set(1)
            p.insertfilter(t2)
        elif var2.get() == 1:
            var2.set(0)
            p.removefilter(t2)

    text.pack()
    var1 = tk.IntVar()
    cb1 = tk.Checkbutton(root, text="Tracer1", command=toggle1, variable=var1)
    cb1.pack()
    var2 = tk.IntVar()
    cb2 = tk.Checkbutton(root, text="Tracer2", command=toggle2, variable=var2)
    cb2.pack()