當前位置: 首頁>>代碼示例>>Python>>正文


Python ttk.Frame方法代碼示例

本文整理匯總了Python中ttk.Frame方法的典型用法代碼示例。如果您正苦於以下問題:Python ttk.Frame方法的具體用法?Python ttk.Frame怎麽用?Python ttk.Frame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ttk的用法示例。


在下文中一共展示了ttk.Frame方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def __init__(self, root, resource_dir, lang="fr"):
        ttk.Frame.__init__(self, root)
        
        self.resource_dir = resource_dir
        self._lang = None
        langs = os.listdir(os.path.join(self.resource_dir, "master"))
        if langs:
            self._lang = (lang if lang in langs else langs[0])
        
        self.items = (os.listdir(os.path.join(self.resource_dir, "master", self._lang)) if self._lang else [])
        self.items.sort(key=lambda x: x.lower())
        max_length = max([len(item) for item in self.items])
        
        self.select_workflow_label = ttk.Label(root, text=u"select workflow:")
        #strVar = tkinter.StringVar()
        self.masters = tkinter.Listbox(root, width=max_length+1, height=len(self.items))#, textvariable=strVar)

        for item in self.items:
            self.masters.insert(tkinter.END, item) 
開發者ID:YoannDupont,項目名稱:SEM,代碼行數:21,代碼來源:components.py

示例2: body

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def body(self, master):
        """
        Add the UI elements to the edit window. Ordering and placement of UI 
        elements in columns is defined by the ``element_layouts`` dictionary.
        """
        main = ttk.Frame(master, padding=(3, 3, 12, 12))
        main.grid(row=0, column=0, sticky="nsew")

        layout = element_layouts[type(self.element).__name__]
        for i, column_tuple in enumerate(layout):
            new_frame = ttk.Frame(master, padding=(3, 3, 12, 12))
            new_frame.grid(row=0, column=i, sticky="nsew")
            row_no = 0
            for row_frame_key in layout[i]:
                for ui_element in self.frame_dict[row_frame_key]:
                    row_no += ui_element.body(new_frame, row_no, left=True)
        if "fastq" in self.frame_dict:
            if self.element.counts_file is not None:
                self.toggle.rb_counts.invoke()
            else:
                self.toggle.rb_fastq.invoke() 
開發者ID:FowlerLab,項目名稱:Enrich2,代碼行數:23,代碼來源:edit_dialog.py

示例3: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def __init__(self,_parent):
        dataSelector.dataLine.__init__(self, _parent, _parent.interior, 'Create Hitbox')
        
        self.hitbox = None
        
        self.name_data = StringVar()
        self.name_entry = Entry(self,textvariable=self.name_data)
        
        self.hitboxPropertiesPanel = ttk.Notebook(self)
        
        self.properties_frame = HitboxPropertiesFrame(self.hitboxPropertiesPanel)
        self.damage_frame = HitboxDamageFrame(self.hitboxPropertiesPanel)
        self.charge_frame = HitboxChargeFrame(self.hitboxPropertiesPanel)
        override_frame = ttk.Frame(self.hitboxPropertiesPanel)
        autolink_frame = ttk.Frame(self.hitboxPropertiesPanel)
        funnel_frame = ttk.Frame(self.hitboxPropertiesPanel)
        
        self.hitboxPropertiesPanel.add(self.properties_frame,text="Properties")
        self.hitboxPropertiesPanel.add(self.damage_frame,text="Damage")
        self.hitboxPropertiesPanel.add(self.charge_frame,text="Charge")
        
        self.name_data.trace('w', self.changeVariable) 
開發者ID:digiholic,項目名稱:universalSmashSystem,代碼行數:24,代碼來源:createHitbox.py

示例4: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def __init__(self,_parent,_root):
        BuilderPanel.__init__(self, _parent, _root)
        self.config(bg="white",height=50)
        
        self.frame_changer_panel = Frame(self)
        
        self.button_minus_five = Button(self.frame_changer_panel, text="-5", command=lambda:self.changeFrameNumber(-5),state=DISABLED)
        self.button_minus = Button(self.frame_changer_panel, text="-1", command=lambda:self.changeFrameNumber(-1),state=DISABLED)
        self.current_frame = Label(self.frame_changer_panel,text="0/1",state=DISABLED)
        self.button_plus = Button(self.frame_changer_panel, text="+1", command=lambda:self.changeFrameNumber(1),state=DISABLED)
        self.button_plus_five = Button(self.frame_changer_panel, text="+5", command=lambda:self.changeFrameNumber(5),state=DISABLED)
        
        self.frame_changer_panel.pack()
        
        self.button_minus_five.grid(row=0,column=0)
        self.button_minus.grid(row=0,column=1)
        self.current_frame.grid(row=0,column=2)
        self.button_plus.grid(row=0,column=3)
        self.button_plus_five.grid(row=0,column=4) 
開發者ID:digiholic,項目名稱:universalSmashSystem,代碼行數:21,代碼來源:builderWindow.py

示例5: changeFrame

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def changeFrame(self, *_args):
        global frame
        
        self.unselect()
        
        self.current_frame_subacts = []
        for subact in action.actions_at_frame[frame]:
            self.current_frame_subacts.append(subact)
        if self.parent.action_selector_panel.current_group.get() == 'Current Frame':
            self.clearSubActList()
            for subact in self.current_frame_subacts:
                selector = subactionSelector.SubactionSelector(self.scroll_frame,subact)
                selector.subaction = subact
                selector.updateName()
                self.subaction_list.append(selector)
            self.showSubactionList() 
開發者ID:digiholic,項目名稱:universalSmashSystem,代碼行數:18,代碼來源:builderWindow.py

示例6: addSubaction

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def addSubaction(self,_subaction):
        global action
        global frame
        
        group_to_action = {'Current Frame': action.actions_at_frame[frame],
                         'Set Up': action.set_up_actions,
                         'Tear Down': action.tear_down_actions,
                         'Transitions': action.state_transition_actions,
                         'Before Frames': action.actions_before_frame,
                         'After Frames': action.actions_after_frame,
                         'Last Frame': action.actions_at_last_frame}
        group = self.parent.action_selector_panel.current_group.get()
        if group_to_action.has_key(group) or group.startswith('Cond:'):
            subact = _subaction()
            if group.startswith('Cond:'):
                action.conditional_actions[group[6:]].append(subact)
            else: group_to_action[group].append(subact)
            self.root.actionModified()
            #self.parent.subaction_panel.addSubactionPanel(subact) 
開發者ID:digiholic,項目名稱:universalSmashSystem,代碼行數:21,代碼來源:builderWindow.py

示例7: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [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

示例8: mainloop

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def mainloop(self):
        try:
            import Tkinter as tk
        except ImportError:
            import tkinter as tk
        from PIL import Image, ImageTk
        from ttk import Frame, Button, Style
        import time
        import socket
        self.root = tk.Toplevel() #Tk()
        self.root.title('Display')
        self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
        self.image1 = ImageTk.PhotoImage(self.image)
        self.panel1 = tk.Label(self.root, image=self.image1)
        self.display = self.image1
        self.frame1 = Frame(self.root, height=50, width=50)
        self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        self.root.after(100, self.advance_image)
        self.root.after(100, self.update_image)
        self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
        #global _started_tkinter_main_loop
        #if not _started_tkinter_main_loop:
        #    _started_tkinter_main_loop = True
        #    print("Starting Tk main thread...") 
開發者ID:jahuth,項目名稱:convis,代碼行數:26,代碼來源:streams.py

示例9: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def __init__(self, master=None, cnf=None, **kwargs):
        self.frame = ttk.Frame(master)
        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)
        self.xbar = AutoScrollbar(self.frame, orient=tkinter.HORIZONTAL)
        self.xbar.grid(row=1, column=0,
                       sticky=tkinter.E + tkinter.W)
        self.ybar = AutoScrollbar(self.frame)
        self.ybar.grid(row=0, column=1,
                       sticky=tkinter.S + tkinter.N)
        tkinter.Canvas.__init__(self, self.frame, cnf or {},
                                xscrollcommand=self.xbar.set,
                                yscrollcommand=self.ybar.set,
                                **kwargs)
        tkinter.Canvas.grid(self, row=0, column=0,
                            sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
        self.xbar.config(command=self.xview)
        self.ybar.config(command=self.yview)
        self.bind("<MouseWheel>", self.on_mousewheel) 
開發者ID:felipeochoa,項目名稱:minecart,代碼行數:21,代碼來源:viewer.py

示例10: demo

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def demo():
    root = tk.Tk()
    root.title("ttk.Notebook")

    nb = ttk.Notebook(root)

    # adding Frames as pages for the ttk.Notebook 
    # first page, which would get widgets gridded into it
    page1 = ttk.Frame(nb)

    # second page
    page2 = ttk.Frame(nb)

    nb.add(page1, text='One')
    nb.add(page2, text='Two')

    nb.pack(expand=1, fill="both")

    root.mainloop() 
開發者ID:PCWG,項目名稱:PCWG,代碼行數:21,代碼來源:tkk_tab.py

示例11: _set_up_tree_widget

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def _set_up_tree_widget(self):

        tree_container = ttk.Frame(self.container)

        tree_container.grid(row=0, column=0, sticky=tk.W+tk.E+tk.N+tk.S)

        #tree_container.pack(fill='both', expand=True)

        # create a treeview with dual scrollbars
        self.tree = ttk.Treeview(tree_container, columns=self.headers, show="headings")
        
        vsb = ttk.Scrollbar(tree_container, orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(tree_container, orient="horizontal", command=self.tree.xview)

        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew')

        vsb.grid(column=1, row=0, sticky='ns')
        hsb.grid(column=0, row=1, sticky='ew')

        tree_container.grid_columnconfigure(0, weight=1)
        tree_container.grid_rowconfigure(0, weight=1)

        self.tree.bind("<Double-1>", self.double_click) 
開發者ID:PCWG,項目名稱:PCWG,代碼行數:26,代碼來源:grid_box.py

示例12: addpage

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def addpage(self, parent, header=[], align=None):
        page = nb.Frame(parent)
        page.grid(pady=10, sticky=tk.NSEW)
        page.columnconfigure(0, weight=1)
        if header:
            self.addpageheader(page, header, align=align)
        return page 
開發者ID:EDCD,項目名稱:EDMarketConnector,代碼行數:9,代碼來源:stats.py

示例13: update

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def update(self, widget):
        assert isinstance(widget, tk.Widget) or isinstance(widget, tk.BitmapImage), widget
        if not self.current:
            return	# No need to call this for widgets created in plugin_app()
        self.register(widget)
        self._update_widget(widget)
        if isinstance(widget, tk.Frame) or isinstance(widget, ttk.Frame):
            for child in widget.winfo_children():
                self._update_widget(child)

    # Apply current theme to a single widget 
開發者ID:EDCD,項目名稱:EDMarketConnector,代碼行數:13,代碼來源:theme.py

示例14: __init__

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [as 別名]
def __init__(self, master=None, **kw):
        if platform == 'darwin':
            kw['background'] = kw.pop('background', PAGEBG)
            tk.Frame.__init__(self, master, **kw)
            tk.Frame(self).grid(pady=5)
        elif platform == 'win32':
            ttk.Frame.__init__(self, master, style='nb.TFrame', **kw)
            ttk.Frame(self).grid(pady=5)	# top spacer
        else:
            ttk.Frame.__init__(self, master, **kw)
            ttk.Frame(self).grid(pady=5)	# top spacer
        self.configure(takefocus = 1)		# let the frame take focus so that no particular child is focused 
開發者ID:EDCD,項目名稱:EDMarketConnector,代碼行數:14,代碼來源:myNotebook.py

示例15: preferences

# 需要導入模塊: import ttk [as 別名]
# 或者: from ttk import Frame [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


注:本文中的ttk.Frame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。