本文整理汇总了Python中ttk.Notebook.select方法的典型用法代码示例。如果您正苦于以下问题:Python Notebook.select方法的具体用法?Python Notebook.select怎么用?Python Notebook.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Notebook
的用法示例。
在下文中一共展示了Notebook.select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NewActionModulation
# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import select [as 别名]
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
示例2: MainWindow
# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import select [as 别名]
#.........这里部分代码省略.........
self.content.pane(2, weight=1)
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()
def _setup_stack_frame_list(self):
self.stack_frame = Frame(self.content)
self.stack_frame.grid(column=0, row=0, sticky=(N, S, E, W))
self.file_notebook.add(self.stack_frame, text='Stack')
self.stack = StackView(self.stack_frame, normalizer=self.filename_normalizer)
self.stack.grid(column=0, row=0, sticky=(N, S, E, W))
# # The tree's vertical scrollbar
self.stack_scrollbar = Scrollbar(self.stack_frame, orient=VERTICAL)
self.stack_scrollbar.grid(column=1, row=0, sticky=(N, S))
# # Tie the scrollbar to the text views, and the text views
# # to each other.
self.stack.config(yscrollcommand=self.stack_scrollbar.set)
self.stack_scrollbar.config(command=self.stack.yview)
# Setup weights for the "stack" tree
self.stack_frame.columnconfigure(0, weight=1)
self.stack_frame.columnconfigure(1, weight=0)
self.stack_frame.rowconfigure(0, weight=1)
# Handlers for GUI events
self.stack.bind('<<TreeviewSelect>>', self.on_stack_frame_selected)
def _setup_breakpoint_list(self):
self.breakpoints_frame = Frame(self.content)
self.breakpoints_frame.grid(column=0, row=0, sticky=(N, S, E, W))
self.file_notebook.add(self.breakpoints_frame, text='Breakpoints')
self.breakpoints = BreakpointView(self.breakpoints_frame, normalizer=self.filename_normalizer)
self.breakpoints.grid(column=0, row=0, sticky=(N, S, E, W))
# The tree's vertical scrollbar
self.breakpoints_scrollbar = Scrollbar(self.breakpoints_frame, orient=VERTICAL)
self.breakpoints_scrollbar.grid(column=1, row=0, sticky=(N, S))
# Tie the scrollbar to the text views, and the text views
# to each other.
self.breakpoints.config(yscrollcommand=self.breakpoints_scrollbar.set)
self.breakpoints_scrollbar.config(command=self.breakpoints.yview)
# Setup weights for the "breakpoint list" tree
self.breakpoints_frame.columnconfigure(0, weight=1)
self.breakpoints_frame.columnconfigure(1, weight=0)
self.breakpoints_frame.rowconfigure(0, weight=1)
# Handlers for GUI events
self.breakpoints.tag_bind('breakpoint', '<Double-Button-1>', self.on_breakpoint_double_clicked)
self.breakpoints.tag_bind('breakpoint', '<<TreeviewSelect>>', self.on_breakpoint_selected)
self.breakpoints.tag_bind('file', '<<TreeviewSelect>>', self.on_breakpoint_file_selected)
def _setup_code_area(self):
self.code_frame = Frame(self.content)
self.code_frame.grid(column=1, row=0, sticky=(N, S, E, W))
示例3: View
# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import select [as 别名]
#.........这里部分代码省略.........
self.server_port_label.place(x=20, y=120)
self.server_port_entity.place(x=20, y=140)
self.raas_port_label.place(x=20, y=160)
self.raas_port_entity.place(x=20, y=180)
self.encoding_label.place(x=20, y=200)
self.encoding_entry.place(x=20, y=220)
self.check_debug.place(x=20, y=250)
self.f = Frame(self.root, height=1, width=190, bg='grey')
self.f.place(x=15, y=275)
self.levenshtein_distance_label.place(x=20, y=280)
self.levenshtein_distance_entry.place(x=20, y=300)
self.window_time_label.place(x=20, y=320)
self.window_time_entry.place(x=20, y=340)
self.check_use_filter.place(x=20, y=370)
def del_channel(self, numb):
rwidth = self.root.winfo_width()
rheight = self.root.winfo_height()
if self.channels_num > 6:
self.chanelFrame.config(width=self.chanelFrame.winfo_width() - 65)
self.root.geometry("%dx%d" % (rwidth - 65, rheight))
if self.channels_num == 6:
self.chanelFrame.config(width=self.chanelFrame.winfo_width() - 20)
self.root.geometry("%dx%d" % (rwidth - 20, rheight))
dvar = self.tabs.tabs().index(self.tabs.select())
self.in_channel_text.pop(dvar)
self.out_channel_text.pop(dvar)
self.out_port_text.pop(dvar)
self.channels_num -= 1
self.tabs.forget(self.tabs.select())
tabs_list = self.tabs.tabs()
self.root.update()
def add_channel(self, env):
if self.channels_num > 15:
tkMessageBox.showerror('Error',
'You can not add more than 16 channels')
return False
rwidth = self.root.winfo_width()
rheight = self.root.winfo_height()
if self.channels_num == 5:
self.chanelFrame.config(width=self.chanelFrame.winfo_width() + 20)
self.root.geometry("%dx%d" % (rwidth + 20, rheight))
if self.channels_num > 5:
self.chanelFrame.config(width=self.chanelFrame.winfo_width() + 65)
self.root.geometry("%dx%d" % (rwidth + 65, rheight))
self.f1 = Frame(self.tabs, height=290, width=350)
self.tabs.add(self.f1,
text='Channel {0}'.format(self.channels_amount + 1))
self.in_channel = Label(self.f1, text="In channel")
示例4: Application
# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import select [as 别名]
class Application(tk.Frame):
def __init__(self, master):
tk.Frame.__init__(self, master)
self.master = master
self.master.title("Netstat Live")
self.pack(fill=tk.BOTH, expand=tk.Y)
master.protocol("WM_DELETE_WINDOW", self.app_quit)
self._app_quit = False
self._freeze = False
self.tabs = Notebook(self)
self.tabs_frames = OrderedDict()
self.tabs_frames['TCP4'] = {'query': netstat_tcp4}
self.tabs_frames['UDP4'] = {'query': netstat_udp4}
self.tabs_frames['TCP6'] = {'query': netstat_tcp6}
self.tabs_frames['UDP6'] = {'query': netstat_udp6}
for tab in self.tabs_frames:
# Creating tabs
self.tabs_frames[tab]['tab'] = tk.Frame(self.tabs)
self.tabs.add(self.tabs_frames[tab]['tab'], text=tab)
#self.tabs_frames[tab]['tab'].pack(fill=tk.BOTH)
# Adding Treeview widget to tabs
self.tabs_frames[tab]['tbl'] = Treeview(self.tabs_frames[tab]['tab'])
self.tabs_frames[tab]['tbl']['columns'] = ('Pid', 'User', 'Local addr', 'Remote addr', 'State')
for column in self.tabs_frames[tab]['tbl']['columns']:
self.tabs_frames[tab]['tbl'].heading(column, text=column)
self.tabs_frames[tab]['tbl'].column(column, width=150)
self.tabs_frames[tab]['scrollbar_y'] = Scrollbar(self.tabs_frames[tab]['tab'], orient=tk.VERTICAL, command=self.tabs_frames[tab]['tbl'].yview)
self.tabs_frames[tab]['tbl']['yscroll'] = self.tabs_frames[tab]['scrollbar_y'].set
self.tabs_frames[tab]['scrollbar_y'].pack(side=tk.RIGHT, fill=tk.Y)
self.tabs_frames[tab]['tbl'].pack(expand=tk.Y, fill=tk.BOTH)
# Bind right click event for displaying context menu
self.tabs_frames[tab]['tbl'].bind('<Button-3>', self.context_menu_popup)
self.tabs_frames[tab]['tbl'].bind('<Button-1>', self.context_menu_unpost)
# Creating queue for each tab
self.tabs_frames[tab]['queue'] = Queue(maxsize=1)
self.tabs.pack(fill=tk.BOTH, expand=tk.Y)
# Freeze button
self.buttons = tk.Frame(master)
self.buttons.pack(side=tk.BOTTOM, fill=tk.BOTH)
self.freeze_btn = tk.Button(self.buttons, text='Freeze', command=self.freeze_btn_handler)
self.freeze_btn.pack(side=tk.RIGHT)
# Check dependencies
self._xclip = True
self._whois = True
try:
out = subprocess.check_output(['xclip', '-h'], stderr=subprocess.STDOUT)
except:
self._xclip = False
try:
out = subprocess.check_output(['whois', '--version'], stderr=subprocess.STDOUT)
except:
self._whois = False
# Connections list context menu
self._remote_addr = ''
self.context_menu = tk.Menu(self, tearoff=0)
if self._xclip:
self.context_menu.add_command(label='Copy remote addr.', command=self.xclip)
if self._whois:
self.context_menu.add_command(label='Whois', command=self.whois)
self.tabs.bind('<Button-1>', self.context_menu_unpost)
self.poll = Thread(target=self.thread)
self.poll.start()
def context_menu_popup(self, event):
current_tab = self.get_active_tab()
tbl = self.tabs_frames[current_tab]['tbl']
item = tbl.identify_row(event.y)
if item and len(tbl.get_children(item)) == 0:
tbl.selection_set(item)
# Get remote addr value
self._remote_addr = tbl.set(item, column='Remote addr')
self.context_menu.post(event.x_root, event.y_root)
else:
# Mouse pointer is not over item
pass
def context_menu_unpost(self, event):
self.context_menu.unpost()
def get_active_tab(self):
try:
current_tab = self.tabs.tab(self.tabs.select(), 'text')
return current_tab
except RuntimeError:
# Sometimes raised on KeyboardInterrupt
sys.stderr.write('Terminated.\n')
self._app_quit = True
sys.exit(0)
def thread(self):
while not self._app_quit:
#.........这里部分代码省略.........
示例5: Metadator
# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import select [as 别名]
class Metadator(Tk):
def __init__(self):
u"""
Main window constructor
Creates 1 frame and 2 labeled subframes
"""
# first: the log
# see: http://sametmax.com/ecrire-des-logs-en-python/
self.logger = logging.getLogger()
self.logger.setLevel(logging.DEBUG) # all errors will be get
log_form = logging.Formatter('%(asctime)s || %(levelname)s || %(message)s')
logfile = RotatingFileHandler('Metadator_LOG.log', 'a', 5000000, 1)
logfile.setLevel(logging.DEBUG)
logfile.setFormatter(log_form)
self.logger.addHandler(logfile)
self.logger.info('\n\t ======== Metadator ========') # first messages
self.logger.info('Starting the UI')
# checking the path to GDAL in the path
if "GDAL_DATA" not in env.keys():
try:
gdal.SetConfigOption(str('GDAL_DATA'),
str(path.abspath(r'data/gdal')))
except:
print("Oups! Something has gone wrong...\
see: https://github.com/Guts/Metadator/issues/21")
else:
pass
# basics settings
Tk.__init__(self) # constructor of parent graphic class
self.title(u'Metadator {0}'.format(MetadatorVersion))
self.style = Style() # more friendly windows style
if opersys == 'win32':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.iconbitmap('Metadator.ico') # windows icon
self.uzer = env.get(u'USERNAME')
elif opersys == 'linux2':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.uzer = env.get(u'USER')
icon = Image("photo", file=r'data/img/metadator.gif')
self.call('wm', 'iconphoto', self._w, icon)
self.minsize(580, 100)
self.style.theme_use('clam')
elif opersys == 'darwin':
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.uzer = env.get(u'USER')
else:
self.logger.warning('Operating system not tested')
self.logger.info('Op. system: {0}'.format(platform.platform()))
self.resizable(width=False, height=False)
self.focus_force()
self.logger.info('GDAL version: {}'.format(gdal.__version__))
# variables
self.def_rep = "" # folder to search for
self.def_lang = 'FR' # language to start
self.def_doc = IntVar() # to export into Word
self.def_xls = IntVar() # to export into Excel 2003
self.def_xml = IntVar() # to export into ISO 19139
self.def_cat = IntVar() # to merge all output Word files
self.def_odt = IntVar() # to export into OpenDocumentText
self.def_dict = IntVar() # to make a dictionnary of data
self.def_kass = IntVar() # to handle field name case sensitive
self.def_stat = IntVar() # to active/disable stats fields
self.li_pro = [] # list for profiles in language selected
self.li_shp = [] # list for shapefiles path
self.li_tab = [] # list for MapInfo tables path
self.num_folders = 0 # number of folders explored
self.today = strftime("%Y-%m-%d") # date of the day
self.dico_layer = OD() # dictionary about layer properties
self.dico_profil = OD() # dictionary from profile selected
self.dico_fields = OD() # dictionary for fields information
self.dico_rekur = OD() # dictionary of recurring attributes
self.dico_err = OD() # errors list
self.dico_help = OD() # dictionary of help texts
li_lang = [lg for lg in listdir(r'locale')] # available languages
self.blabla = OD() # texts dictionary
# GUI fonts
ft_tit = tkFont.Font(family="Times", size=10, weight=tkFont.BOLD)
# fillfulling
self.load_settings()
self.load_texts(self.def_lang)
self.li_profiles(self.def_lang)
self.li_rekurs(self.def_lang)
self.recup_help(self.def_lang)
# Tabs
self.nb = Notebook(self)
self.tab_globals = Frame(self.nb) # tab_id = 0
self.tab_options = Frame(self.nb) # tab_id = 1
self.tab_attribs = Frame(self.nb) # tab_id = 2
self.nb.add(self.tab_globals,
text=self.blabla.get('gui_tab1'), padding=3)
self.nb.add(self.tab_options,
text=self.blabla.get('gui_tab2'), padding=3)
self.nb.add(self.tab_attribs,
#.........这里部分代码省略.........