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


Python ttk.Notebook方法代码示例

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


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

示例1: createWidgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [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: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, parent, *tabs, **kwargs):
        super().__init__(parent, **kwargs)
        
        assert all(isinstance(t, str) for t in tabs)

        self.style = ttk.Style(self)
        self.style.configure("TNotebook.Tab")
        self._notebook = ttk.Notebook(self, style="TNotebook")
        self.data = {
            name: tk.Frame(self._notebook)
            for name in tabs}
        self._tab_ids = {}
        for name in self.data:
            self._notebook.add(self.data[name], text=name)
            self._tab_ids[name] = self._notebook.tabs()[-1]
        
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self._notebook.grid(row=0, column=0, sticky="nswe") 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:22,代码来源:tkwidgets.py

示例3: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, master=None):
        super().__init__(master)
        self.pack()
        self.notebook = Notebook(self)
        self.init_pf()
        self.init_vmat()
        self.init_catphan()
        self.init_logs()
        # self.init_tg51()
        self.init_star()
        self.init_planar_imaging()
        self.init_winstonlutz()
        self.init_watcher()
        self.init_help()
        for child in self.winfo_children():
            child.grid_configure(padx=10, pady=10) 
开发者ID:jrkerns,项目名称:pylinac,代码行数:18,代码来源:py_gui.py

示例4: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, master):
        self.master = master
        self.notebk = ttk.Notebook(self.master)
        self.notebk.pack()
        self.frame1 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
        self.frame2 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
        self.notebk.add(self.frame1, text = 'One')
        self.notebk.add(self.frame2, text = 'Two')
        
        self.btn = ttk.Button(self.frame1, text='Add/Insert Tab at Position 1', command = self.AddTab)
        self.btn.pack()
        
        self.btn2 = ttk.Button(self.frame1, text='Disable Tab at Position 1', command = self.disableTab)
        self.btn2.pack()

        strdisplay = r'Tab ID:{}'.format(self.notebk.select())
        ttk.Label(self.frame1, text = strdisplay).pack()
        
        strdisplay2 = 'Tab index:{}'.format(self.notebk.index(self.notebk.select()))
        ttk.Label(self.frame1, text = strdisplay2).pack() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:22,代码来源:program12.py

示例5: notebook_callback

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def notebook_callback(event):
    clear_display_area()
    
    current_notebook = str(event.widget)
    tab_no = str(event.widget.index("current") + 1)   
    
    if current_notebook.endswith('notebook'):
        active_notebook = 'Notebook 1'
    elif current_notebook.endswith('notebook2'):
        active_notebook = 'Notebook 2'
    else:
        active_notebook = ''
        
    if active_notebook is 'Notebook 1':  
        if   tab_no == '1': display_tab1()
        elif tab_no == '2': display_tab2()
        elif tab_no == '3': display_tab3()
        else: display_button(active_notebook, tab_no)
    else:
        display_button(active_notebook, tab_no)


#-----------------------------------------------------------
#  Create GUI
#----------------------------------------------------------- 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:27,代码来源:GUI_Complexity_end_tab3_multiple_notebooks.py

示例6: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self):
        super().__init__()
        self.title("Ttk Notebook")

        todos = {
            "Home": ["Do the laundry", "Go grocery shopping"],
            "Work": ["Install Python", "Learn Tkinter", "Reply emails"],
            "Vacations": ["Relax!"]
        }

        self.notebook = ttk.Notebook(self, width=250, height=100, padding=10)
        for key, value in todos.items():
            frame = ttk.Frame(self.notebook)
            self.notebook.add(frame, text=key, underline=0,
                              sticky=tk.NE + tk.SW)
            for text in value:
                ttk.Label(frame, text=text).pack(anchor=tk.W)
        self.label = ttk.Label(self)

        self.notebook.pack()
        self.label.pack(anchor=tk.W)
        self.notebook.enable_traversal()
        self.notebook.bind("<<NotebookTabChanged>>", self.select_tab) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:25,代码来源:chapter8_05.py

示例7: body

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def body(self, master):
        self.notebook = ttk.Notebook(master)
        self.notebook.enable_traversal()
        self.generalFrame = ttk.Frame(self.notebook)
        self.create_general_widgets(self.generalFrame)
        self.layout_general_widgets(self.generalFrame)
        self.advancedFrame = ttk.Frame(self.notebook)
        self.create_advanced_widgets(self.advancedFrame)
        self.layout_advanced_widgets(self.advancedFrame)
        self.notebook.add(self.generalFrame, text=GENERAL,
                underline=-1 if TkUtil.mac() else 0, padding=PAD)
        self.notebook.add(self.advancedFrame, text=ADVANCED,
                underline=-1 if TkUtil.mac() else 0, padding=PAD)
        self.notebook.pack(fill=tk.BOTH)
        self.create_bindings()
        return self.notebook 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:18,代码来源:Preferences.py

示例8: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        self.tabs = ttk.Notebook(self)
        self.title("PickTrue - 相册下载器 v%s" % version.__version__)
        self.build_menu()

        for downloader in downloaders:
            self.tabs.add(downloader(self), text=downloader.title)
        self.tabs.pack(
            side=tk.LEFT,
        ) 
开发者ID:winkidney,项目名称:PickTrue,代码行数:13,代码来源:__main__.py

示例9: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, master=None, **kw):
        ttk.Notebook.__init__(self, master, **kw)
        self.bind("<<NotebookTabChanged>>", self._on_tab_changed) 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:5,代码来源:xuexi.py

示例10: preferences

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [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

示例11: create_bindings

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def create_bindings(self):
        if not TkUtil.mac():
            for letter in "dlmrstz":
                self.bind("<Alt-{}>".format(letter), self.handle_shortcut)
            # Don't need these thanks to Notebook.enable_traversal()
            #self.bind("<Alt-a>", 
            #        lambda event: self.notebook.select(self.advancedFrame))
            #self.bind("<Alt-g>", 
            #        lambda event: self.notebook.select(self.generalFrame)) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:11,代码来源:Preferences.py

示例12: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, master=None, **kwargs):

        tk.Frame.__init__(self, master, **kwargs)
        self.pack(fill=tk.BOTH)

        self.Options = WorkflowOptions()

        space_label = tk.Label(self, text=' ')
        space_label.grid(column=0, row=0)

        # Input CPACS file
        self.label = tk.Label(self, text='  Input CPACS file')
        self.label.grid(column=0, row=1)

        self.path_var = tk.StringVar()
        self.path_var.set(self.Options.cpacs_path)
        value_entry = tk.Entry(self, textvariable=self.path_var, width= 45)
        value_entry.grid(column=1, row=1)

        self.browse_button = tk.Button(self, text="Browse", command=self._browse_file)
        self.browse_button.grid(column=2, row=1, pady=5)

        # Notebook for tabs
        self.tabs = ttk.Notebook(self)
        self.tabs.grid(column=0, row=2, columnspan=3,padx=10,pady=10)

        self.TabPre = Tab(self, 'Pre')
        self.TabOptim = Tab(self, 'Optim')
        self.TabPost = Tab(self, 'Post')

        self.tabs.add(self.TabPre, text=self.TabPre.name)
        self.tabs.add(self.TabOptim, text=self.TabOptim.name)
        self.tabs.add(self.TabPost, text=self.TabPost.name)

        # General buttons
        self.close_button = tk.Button(self, text='Save & Quit', command=self._save_quit)
        self.close_button.grid(column=2, row=3) 
开发者ID:cfsengineering,项目名称:CEASIOMpy,代码行数:39,代码来源:workflowcreator.py

示例13: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [as 别名]
def __init__(self, master, cpacs_path, cpacs_out_path, submodule_list, **kwargs):
        tk.Frame.__init__(self, master, **kwargs)
        self.pack(fill=tk.BOTH)

        self.submodule_list = submodule_list
        self.cpacs_out_path = cpacs_out_path

        # Notebook for tabs
        self.tabs = ttk.Notebook(self)
        self.tabs.grid(row=0, column=0, columnspan=3)  #pack()#expand=1, side=tk.LEFT)

        self.tixi = cpsf.open_tixi(cpacs_path)

        if len(apm.get_aeromap_uid_list(self.tixi)) == 0 :
            aeromap_uid = 'AeroMap_1point'
            csv_path = os.path.join(MODULE_DIR,'..','..','test','AeroMaps','Aeromap_1point.csv')
            apm.aeromap_from_csv(self.tixi, aeromap_uid, csv_path)

        # Generate AeroMaps Edition tab
        aeromap_tap = AeroMapTab(self.tabs, self.tixi)

        # Generate Auto Tab =============
        self.tab_list = []
        self._update_all()

        # General button
        self.update_button = tk.Button(self, text='Update', command=self._update_all)
        self.update_button.grid(row=1, column=1,sticky='E')
        self.close_button = tk.Button(self, text='Save & Quit', command=self._save_quit)
        self.close_button.grid(row=1, column=2,sticky='W') 
开发者ID:cfsengineering,项目名称:CEASIOMpy,代码行数:32,代码来源:settingsgui.py

示例14: createWidgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [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

示例15: createWidgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Notebook [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=' Mighty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        
        
        ttk.Label(self.monty, text="Enter a name:").grid(column=0, row=0, sticky='W')
        self.name = tk.StringVar()
        nameEntered = ttk.Entry(self.monty, width=12, textvariable=self.name)
        nameEntered.grid(column=0, row=1, sticky='W')

        self.action = ttk.Button(self.monty, text="Click Me!")   
        self.action.grid(column=2, row=1)
        
        ttk.Label(self.monty, text="Choose a number:").grid(column=1, row=0)
        number = tk.StringVar()
        numberChosen = ttk.Combobox(self.monty, width=12, textvariable=number)
        numberChosen['values'] = (42)
        numberChosen.grid(column=1, row=1)
        numberChosen.current(0)
   
        scrolW = 30; scrolH = 3
        self.scr = scrolledtext.ScrolledText(self.monty, width=scrolW, height=scrolH, wrap=tk.WORD)
        self.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)

        nameEntered.focus()     
#========================== 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:38,代码来源:GUI_OOP.py


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