当前位置: 首页>>代码示例>>Python>>正文


Python Tkinter.Radiobutton方法代码示例

本文整理汇总了Python中Tkinter.Radiobutton方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.Radiobutton方法的具体用法?Python Tkinter.Radiobutton怎么用?Python Tkinter.Radiobutton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter的用法示例。


在下文中一共展示了Tkinter.Radiobutton方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: select_layer_rb

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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] 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:22,代码来源:gui.py

示例2: crear_widgets

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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) 
开发者ID:tidus747,项目名称:Tutoriales_juegos_Python,代码行数:24,代码来源:juegochozas.py

示例3: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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') 
开发者ID:brysontyrrell,项目名称:MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter,代码行数:20,代码来源:Tkinter_Widget_Examples.py

示例4: add_radio_button

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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) 
开发者ID:dark-archerx,项目名称:Traffic-Signs-and-Object-Detection,代码行数:7,代码来源:example.py

示例5: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter 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) 
开发者ID:EDCD,项目名称:EDMarketConnector,代码行数:11,代码来源:myNotebook.py

示例6: create

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
def create(self, **kwargs):
        return tkinter.Radiobutton(self.root, **kwargs) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:4,代码来源:test_widgets.py

示例7: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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 
开发者ID:VCCRI,项目名称:SVPV,代码行数:17,代码来源:gui_widgets.py

示例8: create

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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") 
开发者ID:SystemRage,项目名称:py-kms,代码行数:14,代码来源:pykms_GuiMisc.py

示例9: select_plots_dir_rb

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [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) 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:28,代码来源:gui.py

示例10: __configPanel

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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') 
开发者ID:EvilCult,项目名称:Video-Downloader,代码行数:36,代码来源:guiClass.py

示例11: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Radiobutton [as 别名]
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) 
开发者ID:jakevdp,项目名称:sklearn_pydata2015,代码行数:60,代码来源:svm_gui.py


注:本文中的Tkinter.Radiobutton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。