本文整理汇总了Python中ttk.Notebook方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Notebook方法的具体用法?Python ttk.Notebook怎么用?Python ttk.Notebook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk
的用法示例。
在下文中一共展示了ttk.Notebook方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def __init__(self, master=None, **kw):
ttk.Notebook.__init__(self, master, **kw)
style = ttk.Style()
if platform=='darwin':
if map(int, mac_ver()[0].split('.')) >= [10,10]:
# Hack for tab appearance with 8.5 on Yosemite & El Capitan. For proper fix see
# https://github.com/tcltk/tk/commit/55c4dfca9353bbd69bbcec5d63bf1c8dfb461e25
style.configure('TNotebook.Tab', padding=(12,10,12,2))
style.map('TNotebook.Tab', foreground=[('selected', '!background', 'systemWhite')])
self.grid(sticky=tk.NSEW) # Already padded apropriately
elif platform == 'win32':
style.configure('nb.TFrame', background=PAGEBG)
style.configure('nb.TButton', background=PAGEBG)
style.configure('nb.TCheckbutton', foreground=PAGEFG, background=PAGEBG)
style.configure('nb.TMenubutton', foreground=PAGEFG, background=PAGEBG)
style.configure('nb.TRadiobutton', foreground=PAGEFG, background=PAGEBG)
self.grid(padx=10, pady=10, sticky=tk.NSEW)
else:
self.grid(padx=10, pady=10, sticky=tk.NSEW)
示例2: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [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)
示例3: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def __init__(self, parent_window):
Frame.__init__(self, parent_window)
# Configure the window
self.configure(background=window_background_color)
# Create the header
Header(self).grid(row=0, columnspan=4)
s = ttk.Style()
s.configure(".", font=("Arial", 15))
tab_control = ttk.Notebook(self)
attack_tab = TabFrame(tab_control, ExportOptions.ATTACK)
tab_control.add(attack_tab, text="Attack")
attacksuite_tab = TabFrame(tab_control, ExportOptions.ATTACK_SUITE)
tab_control.add(attacksuite_tab, text="Attack Suite")
protocol_tab = TabFrame(tab_control, ExportOptions.PROTOCOL)
tab_control.add(protocol_tab, text="Protocol")
tab_control.grid(row=1, column=0, columnspan=4, rowspan=3, sticky=W + E + S + N)
CustomButton(self, back_to_menu_label, lambda: change_frame(self, ExtensionPage(root)), 7, None, E, 1)
self.grid()
示例4: demo
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [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()
示例5: preferences
# 需要导入模块: import ttk [as 别名]
# 或者: from 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
#
示例6: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def __init__(self, master, side=LEFT):
self.dir_opt = {}
# Title of the application
master.title("DICAT")
# Use notebook (nb) from ttk from Tkinter to create tabs
self.nb = ttk.Notebook(master)
# Add frames as pages for ttk.Notebook
self.page1 = ttk.Frame(self.nb)
# Second page, DICOM anonymizer
self.page2 = ttk.Frame(self.nb)
# Third page, Scheduler
self.page3 = ttk.Frame(self.nb)
# Fourth page, ID key
self.page4 = ttk.Frame(self.nb)
# Add the pages to the notebook
self.nb.add(self.page1, text='Welcome to DicAT!')
self.nb.add(self.page2, text='DICOM de-identifier')
self.nb.add(self.page3, text='Scheduler', state='hidden') # hide scheduler for now
self.nb.add(self.page4, text='ID key')
# Draw
self.nb.pack(expand=1, fill='both')
# Draw content of the different tabs' frame
self.dicom_deidentifier_tab()
self.id_key_frame()
self.welcome_page()
示例7: setUp
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def setUp(self):
support.root_deiconify()
self.nb = ttk.Notebook(padding=0)
self.child1 = ttk.Label()
self.child2 = ttk.Label()
self.nb.add(self.child1, text='a')
self.nb.add(self.child2, text='b')
示例8: create
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def create(self, **kwargs):
return ttk.Notebook(self.root, **kwargs)
示例9: tabbed_tk_window
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def tabbed_tk_window(self):
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
import sys
if sys.version_info[0] < 3:
import Tkinter as tkinter
import ttk
else:
import tkinter
from tkinter import ttk
self.root_window = tkinter.Tk()
self.root_window.title(self.title)
# quit if the window is deleted
self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit)
nb = ttk.Notebook(self.root_window)
nb.grid(row=1, column=0, sticky='NESW')
for name, fig in self.figures.items():
fig.tight_layout()
tab = ttk.Frame(nb)
canvas = FigureCanvasTkAgg(self.figures[name], master=tab)
canvas.draw()
canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH,
expand=True)
toolbar = NavigationToolbar2Tk(canvas, tab)
toolbar.update()
canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH,
expand=True)
for axes in fig.get_axes():
if isinstance(axes, Axes3D):
# must explicitly allow mouse dragging for 3D plots
axes.mouse_init()
nb.add(tab, text=name)
nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)
self.root_window.mainloop()
self.root_window.destroy()
示例10: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def __init__(self,_parent,_root):
ttk.Notebook.__init__(self, _parent)
self.root = _root
fighter_properties = FighterPropertiesPanel(self,_root)
fighter_actions = ActionListPanel(self,_root)
self.panel_windows = {
'Properties': fighter_properties,
'Actions': fighter_actions
}
for name,window in self.panel_windows.iteritems():
self.add(window,text=name,sticky=N+S+E+W)
示例11: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Notebook [as 别名]
def __init__(self, parent, console):
self.console = console
self.loadImages()
self.style = self.createClosableTabStyle()
parent.bind_class("TNotebook", "<ButtonPress-1>", self.btn_press, True)
parent.bind_class("TNotebook", "<ButtonRelease-1>", self.btn_release)
#add notebook (holds tabs)
self.nb = ttk.Notebook(parent, style="ButtonNotebook")
self.nb.pressed_index = None
self.tabs = {}