Python ttk.LabelFrame() Examples

The following are 5 code examples of ttk.LabelFrame(). 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 ttk , or try the search function .
Example #1
Source File: annotation_gui.py    From SEM with MIT License 9 votes vote down vote up
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
Example #2
Source File: test_widgets.py    From oss-ftp with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.LabelFrame(self.root, **kwargs) 
Example #3
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.LabelFrame(self.root, **kwargs) 
Example #4
Source File: gui.py    From stochopy with MIT License 4 votes vote down vote up
def frame1(self):
        self.frame1 = ttk.LabelFrame(self.master, text = "Parameters", borderwidth = 2, relief = "groove")
        self.frame1.place(bordermode = "outside", relwidth = 0.99, relheight = 0.21, relx = 0, x = 5, y = 5, anchor = "nw")
        self.frame1.first_run = True
        
        # function
        function_label = ttk.Label(self.frame1, text = "Function")
        function_option_menu = ttk.OptionMenu(self.frame1, self.function, self.function.get(),
                                              *sorted(self.FUNCOPT))
        
        # max_iter
        max_iter_label = ttk.Label(self.frame1, text = "Maximum number of iterations")
        max_iter_spinbox = Spinbox(self.frame1, from_ = 2, to_ = 9999,
                                   increment = 1, textvariable = self.max_iter,
                                   width = 6, justify = "right", takefocus = True)
        
        # fps
        fps_label = ttk.Label(self.frame1, text = "Delay between frames (ms)")
        fps_spinbox = Spinbox(self.frame1, from_ = 1, to_ = 1000,
                              increment = 1, textvariable = self.interval,
                              width = 6, justify = "right", takefocus = True)
        
        # seed
        seed_button = ttk.Checkbutton(self.frame1, text = "Fix seed",
                                      variable = self.fix_seed, takefocus = False)
        seed_spinbox = Spinbox(self.frame1, from_ = 0, to_ = self.MAX_SEED,
                               increment = 1, textvariable = self.seed,
                               width = 6, justify = "right", takefocus = True)
        
        # solver
        solver_label = ttk.Label(self.frame1, text = "Solver")
        
        solver_option_menu = ttk.OptionMenu(self.frame1, self.solver_name, self.solver_name.get(),
                                            *(self.EAOPT + self.MCOPT), command = self.select_widget)
        
        # constrain
        constrain_button = ttk.Checkbutton(self.frame1, text = "Constrain",
                                      variable = self.constrain, takefocus = False)
        
        # Layout
        function_label.place(relx = 0., x = 5, y = 5, anchor = "nw")
        function_option_menu.place(relx = 0., x = 75, y = 3, anchor = "nw")
        max_iter_label.place(relx = 0., x = 5, y = 30, anchor = "nw")
        max_iter_spinbox.place(width = 80, relx = 0., x = 220, y = 30, anchor = "nw")
        fps_label.place(relx = 0., x = 5, y = 55, anchor = "nw")
        fps_spinbox.place(width = 80, relx = 0., x = 220, y = 55, anchor = "nw")
        seed_button.place(relx = 0., x = 5, y = 80, anchor = "nw")
        seed_spinbox.place(width = 80, relx = 0., x = 220, y = 80, anchor = "nw")
        solver_label.place(relx = 0.35, x = 0, y = 5, anchor = "nw")
        solver_option_menu.place(relx = 0.35, x = 50, y = 3, anchor = "nw")
        constrain_button.place(relx = 0.35, x = 0, y = 80, anchor = "nw") 
Example #5
Source File: progress.py    From aws-inventory with Apache License 2.0 4 votes vote down vote up
def _create_widgets(self):
        # storage for widgets so we don't pollute GUI app instance namespace
        widget_space = collections.namedtuple('WidgetSpace', [
            'button_text',
            'button',
            'label_frame',
            'label_text',
            'label',
            'progress_bar',
            'status_label_text',
            'status_label'
        ])

        button_text = tk.StringVar(value='Start')
        button = ttk.Button(self, textvariable=button_text, command=self._start)
        button.pack()

        label_frame = ttk.LabelFrame(self, text='Service:Region')
        label_frame.pack(fill='x')

        label_text = tk.StringVar()
        label = ttk.Label(label_frame, anchor='w', textvariable=label_text)
        label.pack(fill='x')


        #XXX: add small fraction to max so progress bar doesn't wrap when work finishes
        progress_bar = ttk.Progressbar(
            self,
            orient='horizontal',
            length=self.master.winfo_screenwidth()/5,
            mode='determinate',
            maximum=self.work_count+1e-10
        )
        progress_bar.pack(fill='both')

        status_label_text = tk.StringVar(value='0 / {}'.format(self.work_count))
        status_label = ttk.Label(self, anchor='w', textvariable=status_label_text)
        status_label.pack(fill='x')

        return widget_space(button_text,
                            button,
                            label_frame,
                            label_text,
                            label,
                            progress_bar,
                            status_label_text,
                            status_label)