Python Tkinter.Radiobutton() Examples
The following are 14
code examples of Tkinter.Radiobutton().
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: gui.py From snn_toolbox with MIT License | 6 votes |
def select_layer_rb(self): """Select layer.""" if hasattr(self, 'layer_frame'): self.layer_frame.pack_forget() self.layer_frame.destroy() self.layer_frame = tk.LabelFrame(self.graph_frame, labelanchor='nw', text="Select layer", relief='raised', borderwidth='3', bg='white') self.layer_frame.pack(side='bottom', fill=None, expand=False) self.plots_dir = os.path.join(self.gui_log.get(), self.selected_plots_dir.get()) if os.path.isdir(self.plots_dir): layer_dirs = [d for d in sorted(os.listdir(self.plots_dir)) if d != 'normalization' and os.path.isdir(os.path.join(self.plots_dir, d))] [tk.Radiobutton(self.layer_frame, bg='white', text=name, value=name, command=self.display_graphs, variable=self.layer_to_plot).pack( fill='both', side='bottom', expand=True) for name in layer_dirs]
Example #2
Source File: juegochozas.py From Tutoriales_juegos_Python with GNU General Public License v3.0 | 6 votes |
def crear_widgets(self): self.var = IntVar() self.background_label = Label(self.container, image=self.imagen_fondo) txt = "Selecciona una choza en la que entrar. Ganarás si:\n" txt += "La choza está vacia o si su ocupante es tu aliado, de lo contrario morirás" self.info_label = Label(self.container, text=txt, bg='white') # Creamos un dicionario con las opciones para las imagenes de las chozas r_btn_config = {'variable': self.var, 'bg': '#8AA54C', 'activebackground': 'green', 'image': self.imagen_choza, 'height': self.alto_choza, 'width': self.ancho_choza, 'command': self.radio_btn_pressed} self.r1 = Radiobutton(self.container, r_btn_config, value=1) self.r2 = Radiobutton(self.container, r_btn_config, value=2) self.r3 = Radiobutton(self.container, r_btn_config, value=3) self.r4 = Radiobutton(self.container, r_btn_config, value=4) self.r5 = Radiobutton(self.container, r_btn_config, value=5)
Example #3
Source File: Tkinter_Widget_Examples.py From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License | 6 votes |
def __init__(self, master): tk.Frame.__init__(self, master) self.pack(padx=20, pady=20) self.master = master self.selection = tk.StringVar() self.selection.set('white') tk.Label(self, text="These are radiobuttons").pack() tk.Radiobutton(self, text='White', value='white', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Red', value='red', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Green', value='green', variable=self.selection, command=self.set_color).pack(anchor='w') tk.Radiobutton(self, text='Blue', value='blue', variable=self.selection, command=self.set_color).pack(anchor='w')
Example #4
Source File: example.py From Traffic-Signs-and-Object-Detection with GNU General Public License v3.0 | 5 votes |
def add_radio_button(self, text, index): maptype = self.maptypes[index] tk.Radiobutton(self.radiogroup, text=maptype, variable=self.radiovar, value=index, command=lambda:self.usemap(maptype)).grid(row=0, column=index)
Example #5
Source File: myNotebook.py From EDMarketConnector with GNU General Public License v2.0 | 5 votes |
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)
Example #6
Source File: test_widgets.py From oss-ftp with MIT License | 5 votes |
def create(self, **kwargs): return tkinter.Radiobutton(self.root, **kwargs)
Example #7
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
def __init__(self, parent): tk.LabelFrame.__init__(self, parent) self.type_var = tk.IntVar(value=0) self.radio_buttons = [tk.Radiobutton(self, text='All', justify=tk.LEFT, variable=self.type_var, value=0)] self.radio_buttons[-1].grid(row=0, column=0, sticky=tk.W) r=1 c=0 for i in range(1, len(SvTypeFilter.types)): self.radio_buttons.append(tk.Radiobutton(self, text=SvTypeFilter.types[i], justify=tk.LEFT, variable=self.type_var, value=i)) self.radio_buttons[-1].grid(row=r, column=c, sticky=tk.W) r += 1 if r > 3: r = 0 c += 1
Example #8
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
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 #9
Source File: pykms_GuiMisc.py From py-kms with The Unlicense | 5 votes |
def create(self): self.rdbtns = [] for n, nameradio in enumerate(self.radios): rdbtn = tk.Radiobutton(self, text = nameradio, value = nameradio, variable = self.radiovar, font = self.font, indicatoron = 0, width = 15, borderwidth = 3, selectcolor = 'yellow', command = self.change) self.textbox.window_create("end", window = rdbtn) # to force one checkbox per line if n != len(self.radios) - 1: self.textbox.insert("end", "\n") self.rdbtns.append(rdbtn) self.textbox.configure(state = "disabled")
Example #10
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 #11
Source File: guiClass.py From Video-Downloader with GNU General Public License v2.0 | 5 votes |
def __configPanel (self) : self.slave = Tkinter.Toplevel(); self.slave.title("Config") self.slave.resizable(width = 'false', height = 'false') l1 = Tkinter.Label(self.slave, text = '下载目录:') l1.grid(row = 0) self.filePath = Tkinter.StringVar() self.filePath.set(self.cfg['path']) e1 = Tkinter.Entry(self.slave, textvariable = self.filePath) e1.grid(row = 0, column = 1, columnspan = 3) b1 = Tkinter.Button(self.slave, text = '选择', command = self.__chooseCfgFolder) b1.grid(row = 0, column = 4, sticky = 'e') l2 = Tkinter.Label(self.slave, text = '检查更新:') l2.grid(row = 1) self.chkUpdateTime = Tkinter.IntVar() self.chkUpdateTime.set(int(self.cfg['udrate'])) r1 = Tkinter.Radiobutton(self.slave, text="每天", variable=self.chkUpdateTime, value=1) r1.grid(row = 1, column = 1, sticky = 'e') r2 = Tkinter.Radiobutton(self.slave, text="每周", variable=self.chkUpdateTime, value=2) r2.grid(row = 1, column = 2, sticky = 'e') r3 = Tkinter.Radiobutton(self.slave, text="每月", variable=self.chkUpdateTime, value=3) r3.grid(row = 1, column = 3, sticky = 'e') b2 = Tkinter.Button(self.slave, text = '更新', command = self.__setConfig) b2.grid(row = 2, column = 1, sticky = 'e') b3 = Tkinter.Button(self.slave, text = '取消', command = self.slave.destroy) b3.grid(row = 2, column = 2, sticky = 'e')
Example #12
Source File: example.py From GooMPy with GNU Lesser General Public License v3.0 | 5 votes |
def add_radio_button(self, text, index): maptype = self.maptypes[index] tk.Radiobutton(self.radiogroup, text=maptype, variable=self.radiovar, value=index, command=lambda:self.usemap(maptype)).grid(row=0, column=index)
Example #13
Source File: test_widgets.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def create(self, **kwargs): return tkinter.Radiobutton(self.root, **kwargs)
Example #14
Source File: svm_gui.py From sklearn_pydata2015 with BSD 3-Clause "New" or "Revised" License | 4 votes |
def __init__(self, root, controller): fm = Tk.Frame(root) kernel_group = Tk.Frame(fm) Tk.Radiobutton(kernel_group, text="Linear", variable=controller.kernel, value=0, command=controller.refit).pack(anchor=Tk.W) Tk.Radiobutton(kernel_group, text="RBF", variable=controller.kernel, value=1, command=controller.refit).pack(anchor=Tk.W) Tk.Radiobutton(kernel_group, text="Poly", variable=controller.kernel, value=2, command=controller.refit).pack(anchor=Tk.W) kernel_group.pack(side=Tk.LEFT) valbox = Tk.Frame(fm) controller.complexity = Tk.StringVar() controller.complexity.set("1.0") c = Tk.Frame(valbox) Tk.Label(c, text="C:", anchor="e", width=7).pack(side=Tk.LEFT) Tk.Entry(c, width=6, textvariable=controller.complexity).pack( side=Tk.LEFT) c.pack() controller.gamma = Tk.StringVar() controller.gamma.set("0.01") g = Tk.Frame(valbox) Tk.Label(g, text="gamma:", anchor="e", width=7).pack(side=Tk.LEFT) Tk.Entry(g, width=6, textvariable=controller.gamma).pack(side=Tk.LEFT) g.pack() controller.degree = Tk.StringVar() controller.degree.set("3") d = Tk.Frame(valbox) Tk.Label(d, text="degree:", anchor="e", width=7).pack(side=Tk.LEFT) Tk.Entry(d, width=6, textvariable=controller.degree).pack(side=Tk.LEFT) d.pack() controller.coef0 = Tk.StringVar() controller.coef0.set("0") r = Tk.Frame(valbox) Tk.Label(r, text="coef0:", anchor="e", width=7).pack(side=Tk.LEFT) Tk.Entry(r, width=6, textvariable=controller.coef0).pack(side=Tk.LEFT) r.pack() valbox.pack(side=Tk.LEFT) cmap_group = Tk.Frame(fm) Tk.Radiobutton(cmap_group, text="Hyperplanes", variable=controller.surface_type, value=0, command=controller.refit).pack(anchor=Tk.W) Tk.Radiobutton(cmap_group, text="Surface", variable=controller.surface_type, value=1, command=controller.refit).pack(anchor=Tk.W) cmap_group.pack(side=Tk.LEFT) train_button = Tk.Button(fm, text='Fit', width=5, command=controller.fit) train_button.pack() fm.pack(side=Tk.LEFT) Tk.Button(fm, text='Clear', width=5, command=controller.clear_data).pack(side=Tk.LEFT)