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


Python ttk.LabelFrame方法代码示例

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


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

示例1: createWidgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def createWidgets(self):    
        tabControl = ttk.Notebook(self.win)     
        tab1 = ttk.Frame(tabControl)            
        tabControl.add(tab1, text='Tab 1')    
        tabControl.pack(expand=1, fill="both")  
        self.monty = ttk.LabelFrame(tab1, text=' Monty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        

        scr = scrolledtext.ScrolledText(self.monty, width=30, height=3, wrap=tk.WORD)
        scr.grid(column=0, row=3, sticky='WE', columnspan=3)

        menuBar = Menu(tab1)
        self.win.config(menu=menuBar)
        fileMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="File", menu=fileMenu)
        helpMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="Help", menu=helpMenu)
        
        self.createButtons() 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Third-Edition,代码行数:21,代码来源:GUI_DesignPattern.py

示例2: display_tab3

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def display_tab3():
    monty3 = ttk.LabelFrame(display_area, text=' New Features ')
    monty3.grid(column=0, row=0, padx=8, pady=4)
    
    # Adding more Feature Buttons
    startRow = 4
    for idx in range(24):
        if idx < 2:
            colIdx = idx
            col = colIdx
        else:
            col += 1
        if not idx % 3: 
            startRow += 1
            col = 0
    
        b = ttk.Button(monty3, text="Feature " + str(idx + 1))   
        b.grid(column=col, row=startRow)    
        
    # Add some space around each label
    for child in monty3.winfo_children(): 
        child.grid_configure(padx=8) 
            
#------------------------------------------ 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:26,代码来源:GUI_Complexity_end_tab3_multiple_notebooks.py

示例3: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def __init__(self, master):
        super().__init__(master, text="Levels", padding=4)
        self.lowest_level = Player.levelmeter_lowest
        self.pbvar_left = tk.IntVar()
        self.pbvar_right = tk.IntVar()
        pbstyle = ttk.Style()
        # pbstyle.theme_use("classic")  # clam, alt, default, classic
        pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
        pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
        pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")

        ttk.Label(self, text="dB").pack(side=tkinter.TOP)
        frame = ttk.LabelFrame(self, text="L.")
        frame.pack(side=tk.LEFT)
        self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
                                       variable=self.pbvar_left, mode='determinate',
                                       style='yellow.Vertical.TProgressbar')
        self.pb_left.pack()

        frame = ttk.LabelFrame(self, text="R.")
        frame.pack(side=tk.LEFT)
        self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
                                        variable=self.pbvar_right, mode='determinate',
                                        style='yellow.Vertical.TProgressbar')
        self.pb_right.pack() 
开发者ID:irmen,项目名称:synthesizer,代码行数:27,代码来源:box.py

示例4: get_group_frame

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def get_group_frame(self, group):
        """ Return a new group frame """
        group = group.lower()
        if self.group_frames.get(group, None) is None:
            logger.debug("Creating new group frame for: %s", group)
            is_master = group == "_master"
            opts_frame = self.optsframe.subframe
            if is_master:
                group_frame = ttk.Frame(opts_frame, name=group.lower())
            else:
                group_frame = ttk.LabelFrame(opts_frame,
                                             text="" if is_master else group.title(),
                                             name=group.lower())

            group_frame.pack(side=tk.TOP, fill=tk.X, padx=5, pady=5, anchor=tk.NW)

            self.group_frames[group] = dict(frame=group_frame,
                                            chkbtns=self.checkbuttons_frame(group_frame))
        group_frame = self.group_frames[group]
        return group_frame 
开发者ID:deepfakes,项目名称:faceswap,代码行数:22,代码来源:control_helper.py

示例5: init_ui

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def init_ui(self):
        """ setup the GUI for the app """
        self.master.title("Speech Demo")
        self.pack(fill=BOTH, expand=True)

        label_frame = LabelFrame(self, text="Words you can speak")
        label_frame.pack(fill=X, padx=10, pady=10)
        self.labels = []
        rows = 4
        cols = 3
        for j in range(rows):
            for i in range(cols):
                k = i  + j * cols
                label = Label(label_frame, text=labels[k])
                label.config(font=("Courier", 36))
                label.grid(row=j,column=i,padx=10, pady=10)
                self.labels += [ label ]
        self.selected = None
        self.after(100, self.ontick) 
开发者ID:castorini,项目名称:honk,代码行数:21,代码来源:speech_demo_tk.py

示例6: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def __init__(self, master):
        self.frame = ttk.Frame(master, width = 100, height = 100)   # frame height and width are in pixel
        self.frame.pack()
        self.frame.config(relief = tk.RAISED)   # to define frame boarder
        self.button = ttk.Button(self.frame, text = 'Click for Magic')
        self.button.config(command = self.performMagic)
        self.button.grid()  # use grid geometry manager
        self.frame.config(padding = (30,15))
        
        self.lbfrm = ttk.LabelFrame(master, width = 100, height = 100)
        self.lbfrm.config(padding = (30, 15))
        self.lbfrm.config(text = "Magic Below")
        self.lbfrm.pack()
        self.label = ttk.Label(self.lbfrm, text = "Waiting for Magic")
        self.label.grid() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:17,代码来源:program9.py

示例7: preferences

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
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
    # 
开发者ID:YoannDupont,项目名称:SEM,代码行数:37,代码来源:annotation_gui.py

示例8: createWidgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def createWidgets():    
    tabControl = ttk.Notebook(win)     
    tab1 = ttk.Frame(tabControl)            
    tabControl.add(tab1, text='Tab 1')    
    tabControl.pack(expand=1, fill="both")  
    monty = ttk.LabelFrame(tab1, text=' Mighty Python ')
    monty.grid(column=0, row=0, padx=8, pady=4)        
    
    ttk.Label(monty, text="Enter a name:").grid(column=0, row=0, sticky='W')
    name = tk.StringVar()
    nameEntered = ttk.Entry(monty, width=12, textvariable=name)
    nameEntered.grid(column=0, row=1, sticky='W')
    
    action = ttk.Button(monty, text="Click Me!")   
    action.grid(column=2, row=1)
    
    ttk.Label(monty, text="Choose a number:").grid(column=1, row=0)
    number = tk.StringVar()
    numberChosen = ttk.Combobox(monty, width=12, textvariable=number)
    numberChosen['values'] = (42)
    numberChosen.grid(column=1, row=1)
    numberChosen.current(0)
    
    scrolW = 30; scrolH = 3
    scr = scrolledtext.ScrolledText(monty, width=scrolW, height=scrolH, wrap=tk.WORD)
    scr.grid(column=0, row=3, sticky='WE', columnspan=3)
    
    menuBar = Menu(tab1)
    win.config(menu=menuBar)
    fileMenu = Menu(menuBar, tearoff=0)
    menuBar.add_cascade(label="File", menu=fileMenu)
    helpMenu = Menu(menuBar, tearoff=0)
    menuBar.add_cascade(label="Help", menu=helpMenu)
    
    nameEntered.focus()     
#====================== 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:38,代码来源:GUI_Not_OOP.py

示例9: display_tab2

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def display_tab2():
    monty2 = ttk.LabelFrame(display_area, text=' Holy Grail ')
    monty2.grid(column=0, row=0, padx=8, pady=4)
    
    # Creating three checkbuttons
    chVarDis = tk.IntVar()
    check1 = tk.Checkbutton(monty2, text="Disabled", variable=chVarDis, state='disabled')
    check1.select()
    check1.grid(column=0, row=0, sticky=tk.W)                 
    
    chVarUn = tk.IntVar()
    check2 = tk.Checkbutton(monty2, text="UnChecked", variable=chVarUn)
    check2.deselect()
    check2.grid(column=1, row=0, sticky=tk.W )                  
     
    chVarEn = tk.IntVar()
    check3 = tk.Checkbutton(monty2, text="Toggle", variable=chVarEn)
    check3.deselect()
    check3.grid(column=2, row=0, sticky=tk.W)                 

    # Create a container to hold labels
    labelsFrame = ttk.LabelFrame(monty2, text=' Labels in a Frame ')
    labelsFrame.grid(column=0, row=7)
     
    # Place labels into the container element - vertically
    ttk.Label(labelsFrame, text="Label1").grid(column=0, row=0)
    ttk.Label(labelsFrame, text="Label2").grid(column=0, row=1)
    
    # Add some space around each label
    for child in labelsFrame.winfo_children(): 
        child.grid_configure(padx=8)
        
#------------------------------------------ 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:35,代码来源:GUI_Complexity_end_tab3_multiple_notebooks.py

示例10: _create_label_frame

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def _create_label_frame(self):
        ''' Creates label frame.
        '''
        self.panel = panel = LabelFrame(self, text=TEXT_FOR_PANEL)
        panel.columnconfigure(0, weight=1)
        panel.rowconfigure(0, weight=1)
        panel.grid(row=1, column=0,
                   padx=5, pady=5, sticky=E+W+S+N) 
开发者ID:araith,项目名称:pyDEA,代码行数:10,代码来源:data_tab_frame_gui.py

示例11: create_widgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def create_widgets(self):
        ''' Creates all widgets.
        '''
        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        validate_btn = Button(self, text='Validate weight restrictions',
                              command=self.on_validate_weights)
        validate_btn.grid(row=0, column=0, padx=10, pady=5, sticky=N+W)

        panel = LabelFrame(self, text='Weight restrictions')
        panel.columnconfigure(0, weight=1)
        panel.rowconfigure(0, weight=1)
        panel.grid(row=1, column=0,
                   padx=5, pady=5, sticky=E+W+S+N)

        weight_tab_main = VerticalScrolledFrame(panel)
        weight_tab_main.grid(row=0, column=0, sticky=E+W+S+N)
        weights_tab = weight_tab_main.interior

        self.abs_weights = TextForWeights(weights_tab, 'absolute',
                                          'Input1 <= 0.02',
                                          self.current_categories, self.params,
                                          'ABS_WEIGHT_RESTRICTIONS')
        self.abs_weights.grid(row=0, column=0, padx=10, pady=5, sticky=N+W)
        self.virtual_weights = TextForWeights(weights_tab, 'virtual',
                                              'Input1 >= 0.34',
                                              self.current_categories,
                                              self.params,
                                              'VIRTUAL_WEIGHT_RESTRICTIONS')
        self.virtual_weights.grid(row=1, column=0, padx=10, pady=5, sticky=N+W)
        self.price_ratio_weights = TextForWeights(weights_tab, 'price ratio',
                                                  'Input1/Input2 <= 5',
                                                  self.current_categories,
                                                  self.params,
                                                  'PRICE_RATIO_RESTRICTIONS',
                                                  True)
        self.price_ratio_weights.grid(row=2, column=0, padx=10, pady=5,
                                      sticky=N+W) 
开发者ID:araith,项目名称:pyDEA,代码行数:41,代码来源:weight_frame_gui.py

示例12: create

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

示例13: checkbuttons_frame

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def checkbuttons_frame(self, frame):
        """ Build and format frame for holding the check buttons
            if is_master then check buttons will be placed in a LabelFrame
            otherwise in a standard frame """
        logger.debug("Add Options CheckButtons Frame")
        chk_frame = ttk.Frame(frame, name="chkbuttons")
        holder = AutoFillContainer(chk_frame, self.option_columns, self.option_columns)
        logger.debug("Added Options CheckButtons Frame")
        return holder 
开发者ID:deepfakes,项目名称:faceswap,代码行数:11,代码来源:control_helper.py

示例14: _multi_option_control

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def _multi_option_control(self, option_type):
        """ Create a group of buttons for single or multi-select

        Parameters
        ----------
        option_type: {"radio", "multi"}
            The type of boxes that this control should hold. "radio" for single item select,
            "multi" for multi item select.

        """
        logger.debug("Adding %s group: %s", option_type, self.option.name)
        help_intro, help_items = self._get_multi_help_items(self.option.helptext)
        ctl = ttk.LabelFrame(self.frame,
                             text=self.option.title,
                             name="{}_labelframe".format(option_type))
        holder = AutoFillContainer(ctl, self.option_columns, self.option_columns)
        for choice in self.option.choices:
            ctl = ttk.Radiobutton if option_type == "radio" else MultiOption
            ctl = ctl(holder.subframe,
                      text=choice.replace("_", " ").title(),
                      value=choice,
                      variable=self.option.tk_var)
            if choice.lower() in help_items:
                self.helpset = True
                helptext = help_items[choice.lower()].capitalize()
                helptext = "{}\n\n - {}".format(
                    '. '.join(item.capitalize() for item in helptext.split('. ')),
                    help_intro)
                _get_tooltip(ctl, text=helptext, wraplength=600)
            ctl.pack(anchor=tk.W)
            logger.debug("Added %s option %s", option_type, choice)
        return holder.parent 
开发者ID:deepfakes,项目名称:faceswap,代码行数:34,代码来源:control_helper.py

示例15: display_demands

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import LabelFrame [as 别名]
def display_demands(label_info, canvas_object, list_of_demands, row_, column_,):
    """Displays a label for demands and a single-select listbox of the
    demands below the label_info on a given canvas_object.  A horizontal
    scrollbar is included """

    demands_frame = LabelFrame(canvas_object)
    demands_frame.grid(row=row_, column=column_, pady=10)

    Label(demands_frame, text=label_info).grid(row=0, column=0, sticky='W', padx=10)

    # Horizontal scrollbar
    horizontal_scrollbar = Scrollbar(demands_frame, orient=HORIZONTAL)
    horizontal_scrollbar.grid(row=3, column=0, sticky=E + W)

    # Vertical scrollbar
    vertical_scrollbar = Scrollbar(demands_frame, orient=VERTICAL)
    vertical_scrollbar.grid(row=1, column=1, sticky=N + S)

    demand_listbox = Listbox(demands_frame, selectmode='single', height=10,
                             width=40, xscrollcommand=horizontal_scrollbar.set,
                             yscrollcommand=vertical_scrollbar.set)
    demand_listbox.grid(row=1, column=0, sticky='W', padx=10)

    vertical_scrollbar.config(command=demand_listbox.yview)

    horizontal_scrollbar.config(command=demand_listbox.xview)

    demand_counter = 1
    for demand in list_of_demands:
        demand_listbox.insert(demand_counter, demand)
        demand_counter += 1

    demand_listbox.bind("<<ListBoxSelect>>", set_active_demand_from_listbox)
    demand_listbox.bind("<Double-Button-1>", set_active_demand_from_listbox) 
开发者ID:tim-fiola,项目名称:network_traffic_modeler_py3,代码行数:36,代码来源:simple_user_interface.py


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