Python tkinter.Radiobutton() Examples

The following are 30 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: chapter8_01.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self.title("Tk themed widgets")

        var = tk.StringVar()
        var.set(self.greetings[0])
        label_frame = ttk.LabelFrame(self, text="Choose a greeting")
        for greeting in self.greetings:
            radio = ttk.Radiobutton(label_frame, text=greeting,
                                    variable=var, value=greeting)
            radio.pack()

        frame = ttk.Frame(self)
        label = ttk.Label(frame, text="Enter your name")
        entry = ttk.Entry(frame)

        command = lambda: print("{}, {}!".format(var.get(), entry.get()))
        button = ttk.Button(frame, text="Greet", command=command)

        label.grid(row=0, column=0, padx=5, pady=5)
        entry.grid(row=0, column=1, padx=5, pady=5)
        button.grid(row=1, column=0, columnspan=2, pady=5)

        label_frame.pack(side=tk.LEFT, padx=10, pady=10)
        frame.pack(side=tk.LEFT, padx=10, pady=10) 
Example #2
Source File: gui.py    From videodownloader with MIT License 6 votes vote down vote up
def threaded_check_video(self):
        self.last_row = 0
        self.stream.set(0)
        [radio_button.destroy() for radio_button in self.stream_widgets]
        url = self.text_url.get()
        if 'https' not in url:
            url = 'https://www.youtube.com/watch?v=%s' % url
        try:
            if self.proxy.get() != '':
                self.video = YouTube(url, proxies={self.proxy.get().split(':')[0]: self.proxy.get()})
            else:
                self.video = YouTube(url)
            self.label_video_title['text'] = self.video.title
            self.streams = self.video.streams.filter(only_audio=self.audio_only.get()).all()

            for stream in self.streams:
                if self.audio_only.get():
                    text = f'Codec: {stream.audio_codec}, ' \
                           f'ABR: {stream.abr} ' \
                           f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB'
                else:
                    if stream.video_codec is None:
                        continue
                    text = f'Res: {stream.resolution}, FPS: {stream.fps},' \
                           f' Video Codec: {stream.video_codec}, Audio Codec: {stream.audio_codec}, ' \
                           f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB'
                radio_button = tk.Radiobutton(self.frame, text=text, variable=self.stream, value=stream.itag)
                self.last_row += 1
                radio_button.grid(row=self.last_row, column=0, columnspan=4)
                self.stream_widgets.append(radio_button)
        except PytubeError as e:
            messagebox.showerror('Something went wrong...', e)
        except RegexMatchError as e:
            messagebox.showerror('Something went wrong...', e)
        finally:
            self.btn_check_id['text'] = 'Check Video'
            self.btn_check_id.config(state=tk.NORMAL) 
Example #3
Source File: gui.py    From snn_toolbox with MIT License 6 votes vote down vote up
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 #4
Source File: juegochozas.py    From Tutoriales_juegos_Python with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: socketMenu.py    From Raspberry-Pi-3-Cookbook-for-Python-Programmers-Third-Edition with MIT License 6 votes vote down vote up
def __init__(self,gui,sw_index,switchCtrl):
    #Add the buttons to window
    self.msgType=TK.IntVar()
    self.msgType.set(SC.MSGOFF)
    self.btn = TK.Button(gui,
                  text=sw_list[sw_index][SW_NAME],
                  width=30, command=self.sendMsg,
                  bg=SW_COLOR[self.msgType.get()])
    self.btn.pack()
    msgOn = TK.Radiobutton(gui,text="On",
              variable=self.msgType, value=SC.MSGON)
    msgOn.pack()
    msgOff = TK.Radiobutton(gui,text="Off",
              variable=self.msgType,value=SC.MSGOFF)
    msgOff.pack()
    self.sw_num=sw_list[sw_index][SW_CMD]
    self.sw_ctrl=switchCtrl 
Example #6
Source File: RadioButton.py    From guizero with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, master, text, value, variable, command=None, grid=None, align=None, visible=True, enabled=None):

        description = "[RadioButton] object with option=\"" + str(text) + "\" value=\"" + str(value) + "\""
        self._text = text
        self._value = value

        # `variable` is the externally passed StringVar keeping track of which
        # option was selected. This class should not be instantiated by a user
        # unless they know what they are doing.
        tk = Radiobutton(master.tk, text=self._text, value=self._value, variable=variable)

        super(RadioButton, self).__init__(master, tk, description, grid, align, visible, enabled, None, None)

    # PROPERTIES
    # -----------------------------------

    # The value of this button 
Example #7
Source File: keyboard_gui.py    From synthesizer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, master, gui):
        super().__init__(master, text="keys: Chords / Arpeggio")
        self.gui = gui
        self.input_mode = tk.StringVar()
        self.input_mode.set("off")
        self.input_rate = tk.DoubleVar()    # duration of note triggers
        self.input_rate.set(0.2)
        self.input_ratio = tk.IntVar()   # how many % the note is on vs off
        self.input_ratio.set(100)
        row = 0
        tk.Label(self, text="Major Chords Arp").grid(row=row, column=0, columnspan=2)
        row += 1
        tk.Radiobutton(self, variable=self.input_mode, value="off", text="off", pady=0, command=self.mode_off_selected,
                       fg=self.cget('fg'), selectcolor=self.cget('bg')).grid(row=row, column=1, sticky=tk.W)
        row += 1
        tk.Radiobutton(self, variable=self.input_mode, value="chords3", text="Chords Maj. 3", pady=0,
                       fg=self.cget('fg'), selectcolor=self.cget('bg')).grid(row=row, column=1, sticky=tk.W)
        row += 1
        tk.Radiobutton(self, variable=self.input_mode, value="chords4", text="Chords Maj. 7th", pady=0,
                       fg=self.cget('fg'), selectcolor=self.cget('bg')).grid(row=row, column=1, sticky=tk.W)
        row += 1
        tk.Radiobutton(self, variable=self.input_mode, value="arpeggio3", text="Arpeggio 3", pady=0,
                       fg=self.cget('fg'), selectcolor=self.cget('bg')).grid(row=row, column=1, sticky=tk.W)
        row += 1
        tk.Radiobutton(self, variable=self.input_mode, value="arpeggio4", text="Arpeggio 7th", pady=0,
                       fg=self.cget('fg'), selectcolor=self.cget('bg')).grid(row=row, column=1, sticky=tk.W)
        row += 1
        tk.Label(self, text="rate").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_rate, from_=0.02, to=.5, resolution=.01,
                 width=10, length=100).grid(row=row, column=1)
        row += 1
        tk.Label(self, text="ratio").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_ratio, from_=1, to=100, resolution=1,
                 width=10, length=100).grid(row=row, column=1) 
Example #8
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 #9
Source File: voyagerimb.py    From voyagerimb with MIT License 5 votes vote down vote up
def view_init(self):
            self.frame = tk.LabelFrame(self.controlwidgets.frame, text=" Offset ")
            ftop = tk.Frame(self.frame)
            fbottom = tk.Frame(self.frame)

            self.offset_entry = NumericalIntEntry(ftop)
            self.offset_entry.textvariable.set("0")
            self.offset_entry.textvariable.trace("w", self.model_sync_with_entry)
            self.offset_entry.Entry.pack(side=tk.LEFT, fill=tk.X, expand=True)
            tk.Button(ftop, text="sub", width=1, command=self.model_decrement_offset).pack(side=tk.LEFT)
            tk.Button(ftop, text="add", width=1, command=self.model_increment_offset).pack(side=tk.LEFT)

            _mm = tk.Frame(fbottom)

            for radiobutrow in [["1000", "100", "10", "1"], ["NoS x SLW", "100 x SLW", "10 x SLW", "1 x SLW"]]:
                _mmm =  tk.Frame(_mm)
                for interval_value in radiobutrow:
                    _m = tk.Radiobutton(_mmm, 
                        text="%s" % (interval_value),
                        indicatoron=0,
                        foreground="#940015",
                        variable=self.interval_value_variable, 
                        value=interval_value,
                        width=1
                    )
                    _m.pack(side=tk.TOP, fill=tk.X, expand=True)
                _mmm.pack(side=tk.LEFT, fill=tk.X, expand=True)
                None

            _mm.pack(side=tk.BOTTOM, fill=tk.X, expand=True)

            ftop.pack(side=tk.TOP, fill=tk.BOTH,  padx=4, pady=4, expand=True)
            fbottom.pack(side=tk.TOP, fill=tk.BOTH,  padx=4, pady=4, expand=True)
            self.frame.pack(side=tk.TOP, fill=tk.X, padx=7, pady=7, expand=False) 
Example #10
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_bottom_frame(self):
        frame = tk.Frame(self.root)

        add_file_icon = tk.PhotoImage(file='../icons/add_file.gif')
        add_file_button = tk.Button(frame, image=add_file_icon, borderwidth=0,
                                    padx=0, text='Add File', command=self.on_add_file_button_clicked)
        add_file_button.image = add_file_icon
        add_file_button.grid(row=5, column=1)

        remove_selected_icon = tk.PhotoImage(
            file='../icons/delete_selected.gif')
        remove_selected_button = tk.Button(
            frame, image=remove_selected_icon, borderwidth=0, padx=0, text='Delete', command=self.on_remove_selected_button_clicked)
        remove_selected_button.image = remove_selected_icon
        remove_selected_button.grid(row=5, column=2)

        add_directory_icon = tk.PhotoImage(file='../icons/add_directory.gif')
        add_directory_button = tk.Button(frame, image=add_directory_icon, borderwidth=0,
                                         padx=0, text='Add Dir', command=self.on_add_directory_button_clicked)
        add_directory_button.image = add_directory_icon
        add_directory_button.grid(row=5, column=3)

        empty_play_list_icon = tk.PhotoImage(
            file='../icons/clear_play_list.gif')
        empty_play_list_button = tk.Button(frame, image=empty_play_list_icon, borderwidth=0,
                                           padx=0, text='Clear All', command=self.on_clear_play_list_button_clicked)
        empty_play_list_button.image = empty_play_list_icon
        empty_play_list_button.grid(row=5, column=4)

        self.loop_value = tk.IntVar()
        self.loop_value.set(3)
        for txt, val in self.loop_choices:
            tk.Radiobutton(frame, text=txt, variable=self.loop_value, value=val).grid(
                row=5, column=4 + val, pady=3)

        frame.grid(row=5, sticky='w', padx=5) 
Example #11
Source File: chapter4_10.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        user_types = ("Administrator", "Supervisor", "Regular user")
        self.user_type = tk.StringVar()
        self.user_type.set(user_types[0])

        label = tk.Label(self, text="Please, select the type of user")
        radios = [tk.Radiobutton(self, text=t, value=t, \
                  variable=self.user_type) for t in user_types]
        btn = tk.Button(self, text="Create user", command=self.open_window)

        label.pack(padx=10, pady=10)
        for radio in radios:
            radio.pack(padx=10, anchor=tk.W)
        btn.pack(pady=10) 
Example #12
Source File: main_gui.py    From JAVER_Assist with MIT License 5 votes vote down vote up
def __tab2_content(self, tab_name):
        sort_section = tk.LabelFrame(tab_name, text='影片整理设置', background=self.__BG_GREY, font=self.__FONT)
        sort_section.place(x=10, y=10, width=880, height=200)

        proxy_section = tk.LabelFrame(tab_name, text='代理服务器设置', background=self.__BG_GREY, font=self.__FONT)
        proxy_section.place(x=10, y=230, width=880, height=200)

        self.radio_var = tk.BooleanVar()
        self.radio_var.set(False)
        unused_proxy = tk.Radiobutton(proxy_section, background=self.__BG_GREY, activebackground=self.__BG_GREY,
                                     font=self.__FONT, anchor='nw', text='不使用代理',
                                     value=False, variable=self.radio_var)
        unused_proxy.place(x=30, y=10, width=150, height=30)
        use_proxy = tk.Radiobutton(proxy_section, background=self.__BG_GREY, activebackground=self.__BG_GREY,
                                   font=self.__FONT, text='使用代理', anchor='nw', value=True, variable=self.radio_var)
        use_proxy.place(x=30, y=70, width=150, height=30)

        tk.Label(proxy_section, text='HTTP服务器IP:', background=self.__BG_GREY,
                 font=self.__FONT, anchor='ne').place(x=200, y=10, width=150, height=30)
        ip = tk.Entry(proxy_section, font=self.__FONT)
        ip.place(x=360, y=10, width=150, height=30)
        ip.insert(0, '127.0.0.1')

        tk.Label(proxy_section, text='端口:', background=self.__BG_GREY,
                 font=self.__FONT, anchor='ne').place(x=530, y=10, width=150, height=30)
        port = tk.Entry(proxy_section, font=self.__FONT)
        port.place(x=690, y=10, width=150, height=30)
        port.insert(0, '8087')

        tk.Label(proxy_section, text='用户名:', background=self.__BG_GREY,
                 font=self.__FONT, anchor='ne').place(x=200, y=70, width=150, height=30)
        user_name = tk.Entry(proxy_section, font=self.__FONT)
        user_name.place(x=360, y=70, width=150, height=30)

        tk.Label(proxy_section, text='密码:', background=self.__BG_GREY,
                 font=self.__FONT, anchor='ne').place(x=530, y=70, width=150, height=30)
        pwd = tk.Entry(proxy_section, font=self.__FONT)
        pwd.place(x=690, y=70, width=150, height=30) 
Example #13
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Radiobutton(self.root, **kwargs) 
Example #14
Source File: test_widgets.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Radiobutton(self.root, **kwargs) 
Example #15
Source File: GUI_queues_put_get_loop.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #16
Source File: GUI_copy_files.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #17
Source File: GUI_queues.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #18
Source File: GUI_URL.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #19
Source File: GUI_Complexity_start.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:             self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:             self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #20
Source File: GUI_Complexity_end_tab3.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:             self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:             self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #21
Source File: GUI_Complexity_start_add_three_more_buttons.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:             self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:             self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #22
Source File: GUI_Complexity_start_add_three_more_buttons_add_more.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:             self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:             self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #23
Source File: GUI_OOP_class_imported_tooltip.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #24
Source File: GUI_OOP_class_imported.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #25
Source File: GUI_OOP_2_classes.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignored_args):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton Callback 
Example #26
Source File: GUI_MySQL.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:             self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:             self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #27
Source File: GUI.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def checkCallback(self, *ignoredArgs):
        # only enable one checkbutton
        if self.chVarUn.get(): self.check3.configure(state='disabled')
        else:                  self.check3.configure(state='normal')
        if self.chVarEn.get(): self.check2.configure(state='disabled')
        else:                  self.check2.configure(state='normal') 
        
    # Radiobutton callback function 
Example #28
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_bottom_frame(self):
        frame = tk.Frame(self.root)

        add_file_icon = tk.PhotoImage(file='../icons/add_file.gif')
        add_file_button = tk.Button(frame, image=add_file_icon, borderwidth=0,
                                    padx=0, text='Add File', command=self.on_add_file_button_clicked)
        add_file_button.image = add_file_icon
        add_file_button.grid(row=5, column=1)
        self.balloon.bind(add_file_button, 'Add New File')

        remove_selected_icon = tk.PhotoImage(
            file='../icons/delete_selected.gif')
        remove_selected_button = tk.Button(
            frame, image=remove_selected_icon, borderwidth=0, padx=0, text='Delete', command=self.on_remove_selected_button_clicked)
        remove_selected_button.image = remove_selected_icon
        remove_selected_button.grid(row=5, column=2)
        self.balloon.bind(remove_selected_button, 'Remove Selected')

        add_directory_icon = tk.PhotoImage(file='../icons/add_directory.gif')
        add_directory_button = tk.Button(frame, image=add_directory_icon, borderwidth=0,
                                         padx=0, text='Add Dir', command=self.on_add_directory_button_clicked)
        add_directory_button.image = add_directory_icon
        add_directory_button.grid(row=5, column=3)
        self.balloon.bind(add_directory_button, 'Add Directory')

        empty_play_list_icon = tk.PhotoImage(
            file='../icons/clear_play_list.gif')
        empty_play_list_button = tk.Button(frame, image=empty_play_list_icon, borderwidth=0,
                                           padx=0, text='Clear All', command=self.on_clear_play_list_button_clicked)
        empty_play_list_button.image = empty_play_list_icon
        empty_play_list_button.grid(row=5, column=4)
        self.balloon.bind(empty_play_list_button, 'Empty play list')

        self.loop_value = tk.IntVar()
        self.loop_value.set(3)
        for txt, val in self.loop_choices:
            tk.Radiobutton(frame, text=txt, variable=self.loop_value, value=val).grid(
                row=5, column=4 + val, pady=3)

        frame.grid(row=5, sticky='w', padx=5) 
Example #29
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_bottom_frame(self):
        frame = tk.Frame(self.root)

        add_file_icon = tk.PhotoImage(file='../icons/add_file.gif')
        add_file_button = tk.Button(frame, image=add_file_icon, borderwidth=0,
                                    padx=0, text='Add File', command=self.on_add_file_button_clicked)
        add_file_button.image = add_file_icon
        add_file_button.grid(row=5, column=1)

        remove_selected_icon = tk.PhotoImage(
            file='../icons/delete_selected.gif')
        remove_selected_button = tk.Button(
            frame, image=remove_selected_icon, borderwidth=0, padx=0, text='Delete', command=self.on_remove_selected_button_clicked)
        remove_selected_button.image = remove_selected_icon
        remove_selected_button.grid(row=5, column=2)

        add_directory_icon = tk.PhotoImage(file='../icons/add_directory.gif')
        add_directory_button = tk.Button(frame, image=add_directory_icon, borderwidth=0,
                                         padx=0, text='Add Dir', command=self.on_add_directory_button_clicked)
        add_directory_button.image = add_directory_icon
        add_directory_button.grid(row=5, column=3)

        empty_play_list_icon = tk.PhotoImage(
            file='../icons/clear_play_list.gif')
        empty_play_list_button = tk.Button(frame, image=empty_play_list_icon, borderwidth=0,
                                           padx=0, text='Clear All', command=self.on_clear_play_list_button_clicked)
        empty_play_list_button.image = empty_play_list_icon
        empty_play_list_button.grid(row=5, column=4)

        self.loop_value = tk.IntVar()
        self.loop_value.set(3)
        for txt, val in self.loop_choices:
            tk.Radiobutton(frame, text=txt, variable=self.loop_value, value=val).grid(
                row=5, column=4 + val, pady=3)

        frame.grid(row=5, sticky='w', padx=5) 
Example #30
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_bottom_frame(self):
        frame = tk.Frame(self.root)

        add_file_icon = tk.PhotoImage(file='../icons/add_file.gif')
        add_file_button = tk.Button(frame, image=add_file_icon, borderwidth=0,
                                    padx=0, text='Add File', command=self.on_add_file_button_clicked)
        add_file_button.image = add_file_icon
        add_file_button.grid(row=5, column=1)

        remove_selected_icon = tk.PhotoImage(
            file='../icons/delete_selected.gif')
        remove_selected_button = tk.Button(
            frame, image=remove_selected_icon, borderwidth=0, padx=0, text='Delete', command=self.on_remove_selected_button_clicked)
        remove_selected_button.image = remove_selected_icon
        remove_selected_button.grid(row=5, column=2)

        add_directory_icon = tk.PhotoImage(file='../icons/add_directory.gif')
        add_directory_button = tk.Button(frame, image=add_directory_icon, borderwidth=0,
                                         padx=0, text='Add Dir', command=self.on_add_directory_button_clicked)
        add_directory_button.image = add_directory_icon
        add_directory_button.grid(row=5, column=3)

        empty_play_list_icon = tk.PhotoImage(
            file='../icons/clear_play_list.gif')
        empty_play_list_button = tk.Button(frame, image=empty_play_list_icon, borderwidth=0,
                                           padx=0, text='Clear All', command=self.on_clear_play_list_button_clicked)
        empty_play_list_button.image = empty_play_list_icon
        empty_play_list_button.grid(row=5, column=4)

        self.loop_value = tk.IntVar()
        self.loop_value.set(3)
        for txt, val in self.loop_choices:
            tk.Radiobutton(frame, text=txt, variable=self.loop_value, value=val).grid(
                row=5, column=4 + val, pady=3)

        frame.grid(row=5, sticky='w', padx=5)