本文整理汇总了Python中ttk.Notebook类的典型用法代码示例。如果您正苦于以下问题:Python Notebook类的具体用法?Python Notebook怎么用?Python Notebook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notebook类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, user):
Notebook.__init__(self, parent)
self.pack(fill=BOTH, expand=1)
for wid, workspace in user.workspaces.iteritems():
widget = WorkspaceWidget(self, workspace)
self.add(widget, text=workspace.name)
checkIdleThread = IdleChecker(user)
checkIdleThread.start()
示例2: _create_panel
def _create_panel(self):
panel = Frame(self, name='elastic')
#panel.pack(side=TOP, fill=BOTH, expand=Y)
panel.grid(row=0, column=0, sticky=NSEW)
nb = Notebook(panel, name='notebook')
nb.enable_traversal()
#nb.pack(fill=BOTH, expand=Y, padx=2, pady=3)
nb.grid(row=0, column=0, sticky=NSEW)
self._create_setup_tab(nb)
self._create_analyze_tab(nb)
示例3: __init__
def __init__(self):
self.parent = Tkinter.Tk()
Notebook.__init__(self, self.parent)
# self.parent.title('Quora Analytics')
self.parent.title("Quora Backup and Analytics")
self.parent.wm_title("Quora Backup and Analytics")
self.parent.grid_rowconfigure(0, weight=1)
self.parent.grid_columnconfigure(0, weight=1)
self.parent.resizable(True, True)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
self.crawler = QuoraCrawler(driver=QuoraCrawler.CHROME_DRIVER)
self._add_frames()
self.pack(fill="both", expand=True)
示例4: __init__
def __init__(self, master, page_names=None, **kw):
"""Constructor arguments:
page_names -- A list of strings, each will be the dictionary key to a
page's widget, and the name displayed on the page's tab. Should be
specified in the desired page order. The first page will be the default
and first active page. If page_names is None or empty, the
TabbedPageSet will be initialized empty.
"""
Notebook.__init__(self, master, **kw)
self.pages = {}
page_names = page_names or ()
for name in page_names:
self.add_page(name)
示例5: _setup_file_lists
def _setup_file_lists(self):
self.file_notebook = Notebook(self.content, padding=(0, 5, 0, 5))
self.content.add(self.file_notebook)
self._setup_stack_frame_list()
self._setup_breakpoint_list()
示例6: initUI
def initUI(self):
self.parent.title("Test")
self.frameTab = Frame(self, relief=RAISED, borderwidth=1)
self.frameTab.grid(row=3, column=0, columnspan=4)
self.grid(row=0, column=0)
self.frameTab.grid(row=0, column=0)
self.note_book = Notebook(self.frameTab)
self.specific_actions = ActionModulation.ActionModulation(self.note_book)
self.note_book.add(self.specific_actions.getFrame(), text="specific actions")
self.general_actions = GeneralActionModulation.GeneralActionModulation(self.note_book)
self.note_book.add(self.general_actions.getFrame(), text="general actions")
self.note_book.grid(row=0, column=0)
self.frameButtons = Frame(self, relief=RAISED, borderwidth=1)
self.frameButtons.grid(row=3, column=0, columnspan=4)
self.buttonReset = Button(self.frameButtons, text="Reset")
self.buttonReset.grid(row=0, column=0)
self.buttonAbort = Button(self.frameButtons, text="Abort")
self.buttonAbort.grid(row=0, column=1)
self.buttonStop = Button(self.frameButtons, text="Stop")
self.buttonStop.grid(row=0, column=2)
self.buttonSendAction = Button(self.frameButtons, text="Send Action")
self.buttonSendAction.grid(row=0, column=4)
self.buttonSendEmotion = Button(self.frameButtons, text="Send Emotion")
self.buttonSendEmotion.grid(row=0, column=5)
示例7: __init__
def __init__(self, master):
master.minsize(width=1500, height=1500)
root = Frame(master)
root.pack(side=TOP, fill=BOTH)
master.title('Stocks evaluation - Sandeep Joshi (FE520)')
n = Notebook(root)
n.enable_traversal()
n.pack(fill=BOTH)
self._create_stat_tab(n)
self._create_help_tab(n)
self.data = {}
self.start = ''
self.end = ''
self.tickers = []
self.tree
示例8: NewActionModulation
class NewActionModulation(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Test")
self.frameTab = Frame(self, relief=RAISED, borderwidth=1)
self.frameTab.grid(row=3, column=0, columnspan=4)
self.grid(row=0, column=0)
self.frameTab.grid(row=0, column=0)
self.note_book = Notebook(self.frameTab)
self.specific_actions = ActionModulation.ActionModulation(self.note_book)
self.note_book.add(self.specific_actions.getFrame(), text="specific actions")
self.general_actions = GeneralActionModulation.GeneralActionModulation(self.note_book)
self.note_book.add(self.general_actions.getFrame(), text="general actions")
self.note_book.grid(row=0, column=0)
self.frameButtons = Frame(self, relief=RAISED, borderwidth=1)
self.frameButtons.grid(row=3, column=0, columnspan=4)
self.buttonReset = Button(self.frameButtons, text="Reset")
self.buttonReset.grid(row=0, column=0)
self.buttonAbort = Button(self.frameButtons, text="Abort")
self.buttonAbort.grid(row=0, column=1)
self.buttonStop = Button(self.frameButtons, text="Stop")
self.buttonStop.grid(row=0, column=2)
self.buttonSendAction = Button(self.frameButtons, text="Send Action")
self.buttonSendAction.grid(row=0, column=4)
self.buttonSendEmotion = Button(self.frameButtons, text="Send Emotion")
self.buttonSendEmotion.grid(row=0, column=5)
def getCurrentTab(self):
return self.note_book.index(self.note_book.select())
def getFirstTab(self):
return self.specific_actions
def getSecondTab(self):
return self.general_actions
def getButtonSendAction(self):
return self.buttonSendAction
def getButtonSendEmotion(self):
return self.buttonSendEmotion
def getButtonReset(self):
return self.buttonReset
def getButtonAbort(self):
return self.buttonAbort
def getButtonStop(self):
return self.buttonStop
示例9: _SetupCanvas
def _SetupCanvas(self):
'''
'''
self.figure = Figure()
self.figure.subplots_adjust(left=0.15, bottom=0.2)
self.subfigure = self.figure.add_subplot(1,1,1)
self.notebook = Notebook(self.toplevel)
self.notebook.grid(row=1, column=1, rowspan=3, columnspan=3, sticky='nsew')
self.canvas = FigureCanvasTkAgg(self.figure, master=self.toplevel)
self.canvas.show()
self.canvas.get_tk_widget().grid(row=0, column=0, rowspan=10)
示例10: init_UI
def init_UI():
'''create tabs and required content'''
# initialize main window
main = Tk()
main.title('data2knowledge')
# component for 'tab' functionality
n = Notebook(main)
# initialize the various tabs
EnrichTab(n, 'Enrich', main)
ProcessTab(n, 'Process', main)
MergeTab(n, 'Merge', main)
LearningTab(n, 'Learn', main)
ReportTab(n, 'Report', main)
AboutTab(n, 'About', main)
# finish up, return UI
n.pack()
return main
示例11: __init__
class Tabs:
def __init__(self, parent):
self.root = Notebook(parent)
self.frames = {}
# self.frame1 = Frame(self.root)
# self.root.add(self.frame1, text=label1)
# self.frame2 = Frame(self.root)
# self.root.add(self.frame2, text=label2)
# self.frame3 = Frame(self.root)
# self.root.add(self.frame3, text=label3)
def add_frame(self, frame, label):
# self.frames.append(frame)
self.root.add(frame, text=label)
self.frames[label] = frame
def get_root(self):
return self.root
示例12: init_ui
def init_ui(self):
#make resizable
self.grid_columnconfigure(0, weight=1)
self.grid_rowconfigure(0, weight=1)
self.notebook = Notebook(self)
# define mainapp instance -- also manages above telemetry thread
self.mainApplication = MainApplication(self, self.client_queue_cmd, self.client_queue_log, self.client_queue_telem, self.beam_gap_queue, self.destroyEvent, self.server_ip)
self.notebook.add(self.mainApplication, text = "Main")
# define telemetry widgets
self.monitor = Monitor(self, VisualConstants.MARS_PRIMARY(1))
self.notebook.add(self.monitor, text = 'Monitor')
self.notebook.grid(column = 0, row = 0, sticky = 'nsew')
# menu -outside of notebook
self.menu_ = TopMenu(self, '../gui/operations.json', self.client_queue_cmd, 'Commands')
### Add custom commands here
self.menu_.add_menu_item('Reconnect to Cameras', self.mainApplication.start_streams, "View")
self.menu_.add_menu_item('Left', self.mainApplication.focus_left, 'View/Camera Focus')
self.menu_.add_menu_item('Center', self.mainApplication.focus_center, 'View/Camera Focus')
self.menu_.add_menu_item('Right', self.mainApplication.focus_right, 'View/Camera Focus')
self.menu_.add_menu_item('IBeam Display', self.beamGapGraph, 'View/Windows')
self.menu_.add_menu_item('Toggle FOD Enabled', self.mainApplication.toggle_fod, 'View/Object Detection')
self.menu_.add_menu_item('Set Ideal Images', self.mainApplication.define_ideal_images, 'View/Object Detection')
###
self.menu_.finalize_menu_items()
self.config(menu=self.menu_)
# start all operations here so we don't cause a hissyfit between tkinter and threads
self.mainApplication.start_streams()
#define telemetryThread
self.tthread = TelemetryThread([self.mainApplication.telemetry_w, self.monitor], self.client_queue_telem, self.beam_gap_queue)
self.tthread.start()
# title and icon
self.wm_title('Hyperloop Imaging Team')
#this is garbage, i hate tkinter
#self.img = ImageTk.PhotoImage(file='rit_imaging_team.xbm')
#self.tk.call('wm', 'iconphoto', self._w, self.img)
#self.iconbitmap('@rit_imaging_team.xbm')
#call destroyCallback on clicking X
self.protocol('WM_DELETE_WINDOW', self.destroyCallback)
#assign dimensions and locatin on screen
width = 900
height = 500
x = (self.winfo_screenwidth() // 2) - (width // 2)
y = (self.winfo_screenheight() // 2) - (height // 2)
self.geometry('{}x{}+{}+{}'.format(width, height, x, y))
self.update()
示例13: show_control
def show_control(master, data):
"""Выводит блокнот управления с пятью закладками"""
if data.is_restart:
reload(control_a)
reload(control_b)
reload(control_c)
reload(control_d)
reload(control_e)
reload(control_f)
from control_a import show_goods
from control_b import show_calc
from control_c import show_sales_goods
from control_d import show_sales
from control_e import show_others
from control_f import show_plus
def tab_changes(tab):
"""функция, срабатывающая при нажатии закладок переключения
между правыми (основными) фреймами"""
window_names = controlTabs.tabs()
index = window_names.index(controlTabs.select())
if not FLAGS[index]:
CONTROL[index](workArea[index], data) #нужна ли эта дата?
FLAGS[index] = True
else:
CONTROL[index].renew()
CONTROL = (show_goods, show_calc, show_sales_goods,
show_sales, show_others, show_plus)
FLAGS = [False, False, False, False, False, False]
heads = (u' Товары ', u' Калькуляции ',
u' Акционные товары ', u' Акционные цены ',
u' Категории, скидки, причины списания ', u' Дополнительно ')
workArea = []
controlTabs = Notebook(master)
for q in range (6):
frame = Canvas(controlTabs, relief=GROOVE, highlightthickness=0)
if USE_BACKGROUND:
frame.create_image(0,0, anchor='nw', image=data.photo)
controlTabs.add(frame, text=heads[q])
workArea.append(frame)
controlTabs.pack(side=TOP, fill=BOTH, expand=YES)
controlTabs.bind('<<NotebookTabChanged>>', tab_changes)
Style().configure("TNotebook.Tab", font=('Verdana', FONT_SIZE))
示例14: __init__
def __init__(self, root):
# 数据载入和分类器训练
bc_dataset = BreastCancerDataSet()
bc_x_train = bc_dataset.x_train
bc_y_train = bc_dataset.y_train
bc_x_test = bc_dataset.x_test
bc_y_test = bc_dataset.y_test
ctg_dataset = CardiotocographyDataSet()
ctg_x_train = ctg_dataset.x_train
ctg_y_train = ctg_dataset.y_train
ctg_x_test = ctg_dataset.x_test
ctg_y_test = ctg_dataset.y_test
# 初始化UI
menubar = Tk.Menu(root) # 添加菜单
root.config(menu=menubar)
filemenu = Tk.Menu(menubar)
filemenu.add_command(label="Exit", command=sys.exit)
menubar.add_cascade(label="File", menu=filemenu)
notebook = Notebook(root) # 添加标签页
notebook.pack(fill=Tk.BOTH)
page_0 = Tk.Frame(notebook)
notebook.add(page_0, text="Main ")
notebook_0 = Notebook(page_0) # 添加子标签页
notebook_0.pack(fill=Tk.BOTH)
page_01 = Tk.Frame(notebook_0)
notebook_0.add(page_01, text="Breast Cancer")
page_02 = Tk.Frame(notebook_0)
notebook_0.add(page_02, text="Cardiotocography")
page_05 = Tk.Frame(notebook_0)
notebook_0.add(page_05, text="Cardiotocography Features Rank")
page_04 = Tk.Frame(notebook_0)
notebook_0.add(page_04, text="Cardiotocography Features Corr")
page_03 = Tk.Frame(notebook_0)
notebook_0.add(page_03, text="Cardiotocography Features Pair")
page_06 = Tk.Frame(notebook_0)
notebook_0.add(page_06, text="Console Output")
page_1 = Tk.Frame(notebook)
notebook.add(page_1, text="Training ")
notebook_1 = Notebook(page_1) # 添加子标签页
notebook_1.pack(fill=Tk.BOTH)
page_11 = Tk.Frame(notebook_1)
notebook_1.add(page_11, text="LR")
page_12 = Tk.Frame(notebook_1)
notebook_1.add(page_12, text="SVM")
page_13 = Tk.Frame(notebook_1)
notebook_1.add(page_13, text="RF")
page_2 = Tk.Frame(notebook)
notebook.add(page_2, text="Testing ")
subnotebook_2 = Notebook(page_2) # 添加子标签页
subnotebook_2.pack(fill=Tk.BOTH)
page_21 = Tk.Frame(subnotebook_2)
subnotebook_2.add(page_21, text="LR")
page_22 = Tk.Frame(subnotebook_2)
subnotebook_2.add(page_22, text="SVM")
page_23 = Tk.Frame(subnotebook_2)
subnotebook_2.add(page_23, text="RF")
page_3 = Tk.Frame(notebook)
notebook.add(page_3, text="Learning Curve")
page_4 = Tk.Frame(notebook)
notebook.add(page_4, text="Validation Curve")
page_5 = Tk.Frame(notebook)
notebook.add(page_5, text="ROC & AUC")
page_6 = Tk.Frame(notebook)
notebook.add(page_6, text="GridSearchCV")
page_7 = Tk.Frame(notebook)
notebook.add(page_7, text="t-SNE")
# 第0页 主页
console = ConsoleFrame(page_06)
console.pack(fill=Tk.BOTH)
bc_eva = Evaluator(scaler=StandardScaler(), pca=PCA(n_components=2), clf=SVC(probability=True, random_state=1))
BreastCancerMainFrame(page_01, bc_x_train, bc_y_train, bc_x_test, bc_y_test, bc_eva, console).pack(fill=Tk.BOTH)
ctg_eva = Evaluator(scaler=StandardScaler(), pca=PCA(n_components=2), clf=SVC(probability=True, random_state=1))
CardiotocographyMainFrame(page_02, ctg_x_train, ctg_y_train, ctg_x_test, ctg_y_test, ctg_eva, console).pack(fill=Tk.BOTH)
FeaturesPairFrame(page_03, ctg_x_train, ctg_y_train, ctg_x_test, ctg_y_test, ctg_eva, ctg_dataset.df, console).pack(
fill=Tk.BOTH)
FeaturesCorrFrame(page_04, ctg_x_train, ctg_y_train, ctg_x_test, ctg_y_test, ctg_eva, ctg_dataset.df, console).pack(
fill=Tk.BOTH)
FeaturesRankFrame(page_05, ctg_x_train, ctg_y_train, ctg_x_test, ctg_y_test, ctg_eva, ctg_dataset.df, console).pack(
fill=Tk.BOTH)
示例15: show_sell_bills
#.........这里部分代码省略.........
index = window_names.index(w_name) - 1
note.select(window_names[index])
button_left = Button(sellTopFrame, image=data.IMG_INTERFACE[3],
command=b_left)
button_left.pack(side=LEFT, padx=5, pady=5)
#------------------------------------------------------------
def b_right():
"""Срабатывает при нажатии кнопки "вправо", сдвигается вправо на
один таб в блокноте со счетами"""
w_name = note.select()
window_names = note.tabs()
if window_names:
index = window_names.index(w_name) + 1
if index == len(window_names):
index = 0
note.select(window_names[index])
button_right = Button(sellTopFrame, image=data.IMG_INTERFACE[4],
command=b_right)
button_right.pack(side=LEFT, padx=5, pady=5)
#------------------------------------------------------------
def b_del():
"""Срабатывает при нажатии кнопки "удалить счет", удаляет таб в
блокноте со счетами"""
w_name = note.select()
window_names = note.tabs()
if not window_names:
button_del_bill.configure(state=DISABLED)
else:
index = window_names.index(w_name)
if not bills[index].bill:
note.forget(note.select())
del(bills[index])
if not note.tabs():
button_del_bill.configure(state=DISABLED)
else:
if tkMessageBox.askokcancel('Внимание!',
'Вы уверены, что хотите удалить этот счет?'):
note.forget(note.select())
del(bills[index])
if not note.tabs():
button_del_bill.configure(state=DISABLED)
button_del_bill = Button(sellTopFrame,text=u'Удалить\nсчет',
style='Little.TButton', command=b_del)
button_del_bill.pack(side=LEFT, padx=10, pady=10, fill=X)
#----- ОСТАВШИЕСЯ ЭЛЕМЕНТЫ - БЛОКНОТ, СЧЕТЧИК ПРОДАЖ, КАЛЬКУЛЯТОР ------
label = Label(sellTopFrame, text='', bg='white',
font=('Lucida Console', FONT_SIZE))
label.pack(side=RIGHT, padx=10, pady=5)
def label_renew():
"""Обновляет счетчик продаж в верхнем правом углу экрана"""
sold = '%6.2f' % round(queries.sell_in_day(),2) + ' грн.'
label.configure(text='СЕГОДНЯ ПРОДАНО\n на ' + sold)
label_renew()
show_sell_bills.label_renew = label_renew
#-----------
button_calc = Button(sellTopFrame, image=data.IMG_INTERFACE[8],
command=calculator_press)
button_calc.pack(side=RIGHT, padx=5, pady=5)
button_paid = Button(sellTopFrame, image=data.IMG_INTERFACE[10], width=8,
compound=LEFT, text=u'Блокнот\nрасходов',
command=lambda: calc_pad(data))
button_paid.pack(side=RIGHT, padx=5, pady=5)
#-----------
note = Notebook(master, style='Custom.TNotebook')
bills = []
note.pack(side=TOP, padx=BILL_PAD_X, pady=BILL_PAD_Y)
#----------- Один пустой столик ставим по умолчанию ----------
bill = Bill(note)
bills.append(bill)
tab = bill.frame
note.add(tab, text = u' Стол 1 ')
#-------------------------------------------------------------
#--------Автоподъем высоты ------------
sellTopFrame.update()
y1 = sellTopFrame.winfo_height()
y2 = note.winfo_height()
master.configure(height = y1 + y2 + 40)
master.pack_propagate(False)
#---------------------------------------
calculator_press.window_calc = False
return bills, note