本文整理汇总了Python中tkinter.ttk.Labelframe方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Labelframe方法的具体用法?Python ttk.Labelframe怎么用?Python ttk.Labelframe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk
的用法示例。
在下文中一共展示了ttk.Labelframe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_widgets
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def create_widgets(self, master):
self.frame = ttk.Frame(master)
self.restoreFrame = ttk.Labelframe(self.frame, text="Restore")
self.restoreWindowCheckbutton = TkUtil.Checkbutton(
self.restoreFrame, text="Window Position and Size",
underline=0, variable=self.restoreWindow)
TkUtil.Tooltip.Tooltip(self.restoreWindowCheckbutton,
"Restore Toolbars and Window Position and Size at Startup")
self.restoreFontCheckbutton = TkUtil.Checkbutton(self.restoreFrame,
text="Font Settings", underline=0,
variable=self.restoreFont)
TkUtil.Tooltip.Tooltip(self.restoreFontCheckbutton,
"Restore the Last Used Font Settings at Startup")
self.restoreSessionCheckbutton = TkUtil.Checkbutton(
self.restoreFrame, text="Session", underline=0,
variable=self.restoreSession)
TkUtil.Tooltip.Tooltip(self.restoreSessionCheckbutton,
"Open the Last Edited File at Startup")
self.otherFrame = ttk.Labelframe(self.frame, text="Other")
self.blinkCheckbutton = TkUtil.Checkbutton(self.otherFrame,
text="Blinking Cursor", underline=0, variable=self.blink)
TkUtil.Tooltip.Tooltip(self.blinkCheckbutton,
"Switch Cursor Blink On or Off")
示例2: setup
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def setup(self):
self.Canvas = tk.Label(self)
self.Canvas.grid(row=0, column=0, columnspan=6, rowspan=6)
ttk.Button(self, text="Prev", command=self.display_prev).grid(row=4, column=6)
ttk.Button(self, text="Next", command=self.display_next).grid(row=4, column=7)
ttk.Button(self, text="Save & Exit", command=self.save_and_exit).grid(
row=5, column=6, columnspan=2
)
self.lfdata = ttk.Labelframe(self, padding=(2, 2, 4, 4), text="Selection")
self.lfdata.grid(row=0, column=6, columnspan=2, sticky="ne")
for i, item in enumerate(digits + "d"):
ttk.Button(
self.lfdata, text=item, command=partial(self.button_callback, item)
).grid(in_=self.lfdata, column=6 + i % 2, row=i // 2, sticky="w")
示例3: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def __init__(self, path_app):
super().__init__()
self.title('Extended PyGISS')
path_icon = abspath(join(path_app, pardir, 'images'))
# generate the PSF tk images
img_psf = ImageTk.Image.open(join(path_icon, 'node.png'))
selected_img_psf = ImageTk.Image.open(join(path_icon, 'selected_node.png'))
self.psf_button_image = ImageTk.PhotoImage(img_psf.resize((100, 100)))
self.node_image = ImageTk.PhotoImage(img_psf.resize((40, 40)))
self.selected_node_image = ImageTk.PhotoImage(selected_img_psf.resize((40, 40)))
for widget in (
'Button',
'Label',
'Labelframe',
'Labelframe.Label',
):
ttk.Style().configure('T' + widget, background='#A1DBCD')
self.map = Map(self)
self.map.pack(side='right', fill='both', expand=1)
self.menu = Menu(self)
self.menu.pack(side='right', fill='both', expand=1)
menu = tk.Menu(self)
menu.add_command(label="Import shapefile", command=self.map.import_map)
self.config(menu=menu)
# if motion is called, the left-click button was released and we
# can stop the drag and drop process
self.bind_all('<Motion>', self.stop_drag_and_drop)
self.drag_and_drop = False
self.image = None
self.bind_all('<B1-Motion>', lambda _:_)
示例4: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def __init__(self, root):
self.root = root
root.title('Logging Handler')
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# Create the panes and frames
vertical_pane = ttk.PanedWindow(self.root, orient=VERTICAL)
vertical_pane.grid(row=0, column=0, sticky="nsew")
horizontal_pane = ttk.PanedWindow(vertical_pane, orient=HORIZONTAL)
vertical_pane.add(horizontal_pane)
form_frame = ttk.Labelframe(horizontal_pane, text="MyForm")
form_frame.columnconfigure(1, weight=1)
horizontal_pane.add(form_frame, weight=1)
console_frame = ttk.Labelframe(horizontal_pane, text="Console")
console_frame.columnconfigure(0, weight=1)
console_frame.rowconfigure(0, weight=1)
horizontal_pane.add(console_frame, weight=1)
third_frame = ttk.Labelframe(vertical_pane, text="Third Frame")
vertical_pane.add(third_frame, weight=1)
# Initialize all frames
self.form = FormUi(form_frame)
self.console = ConsoleUi(console_frame)
self.third = ThirdUi(third_frame)
self.clock = Clock()
self.clock.start()
self.root.protocol('WM_DELETE_WINDOW', self.quit)
self.root.bind('<Control-q>', self.quit)
signal.signal(signal.SIGINT, self.quit)
示例5: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def __init__(self):
"""create a tkk graphic interface with a main window tk_win"""
self.__version__ = '0.9.1'
self._title = "2019-06-16a : 'Support un-named Tabs!'"
self.conn = None # Baresql database object
self.database_file = ""
self.tk_win = Tk()
self.tk_win.title('A graphic SQLite Client in 1 Python file')
self.tk_win.option_add('*tearOff', FALSE) # hint of tk documentation
self.tk_win.minsize(600, 200) # minimal size
self.font_size = 10
self.font_wheight = 0
self.initialdir = "."
# With a Menubar and Toolbar
self.create_menu()
self.create_toolbar()
# Create style "ButtonNotebook"
self.create_style()
# Initiate Drag State
self.state_drag = False
self.state_drag_index = 0
# With a Panedwindow of two frames: 'Database' and 'Queries'
p = ttk.Panedwindow(self.tk_win, orient=HORIZONTAL)
p.pack(fill=BOTH, expand=1)
f_database = ttk.Labelframe(p, text='Databases', width=200, height=100)
p.add(f_database)
f_queries = ttk.Labelframe(p, text='Queries', width=200, height=100)
p.add(f_queries)
# build tree view 't' inside the left 'Database' Frame
self.db_tree = ttk.Treeview(f_database, displaycolumns=[],
columns=("detail", "action"))
self.db_tree.tag_configure("run")
self.db_tree.pack(fill=BOTH, expand=1)
# create a notebook 'n' inside the right 'Queries' Frame
self.n = NotebookForQueries(self.tk_win, f_queries, [])
# Bind keyboard shortcuts
self.tk_win.bind('<F9>', self.run_tab)
示例6: new_query_tab
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Labelframe [as 别名]
def new_query_tab(self, title, query):
"""add a Tab 'title' to the notebook, containing the Script 'query'"""
fw_welcome = ttk.Panedwindow(self.tk_win, orient=VERTICAL) # tk_win
fw_welcome.pack(fill='both', expand=True)
self.notebook.add(fw_welcome, text=(title))
# new "editable" script
f1 = ttk.Labelframe(fw_welcome, text='Script', width=200, height=100)
fw_welcome.add(f1)
fw_label = Text(f1, bd=1, undo=True)
scroll = ttk.Scrollbar(f1, command=fw_label.yview)
fw_label.configure(yscrollcommand=scroll.set)
fw_label.insert(END, (query))
fw_label.pack(side=LEFT, expand=YES, fill=BOTH, padx=2, pady=2)
scroll.pack(side=RIGHT, expand=NO, fill=BOTH, padx=2, pady=2)
# keep tab reference by tk id
working_tab_id = "." + fw_welcome._name
# keep tab reference to script (by tk id)
self.fw_labels[working_tab_id] = fw_label
# new "Results" Container
fr = ttk.Labelframe(fw_welcome, text='Results', width=200, height=100)
fw_welcome.add(fr)
# containing a notebook
fw_result_nb = Notebook(fr, style="ButtonNotebook")
fw_result_nb.pack(fill='both', expand=True)
# resize rules
fw_welcome.columnconfigure(0, weight=1)
# keep reference to result_nb objects (by tk id)
self.fw_result_nbs[working_tab_id] = fw_result_nb
# activate this tab print(self.notebook.tabs())
self.notebook.select(working_tab_id)
# workaround to have a visible result pane on initial launch
self.add_treeview(
working_tab_id, "_", "", "click on ('->') to run Script")
return working_tab_id # gives back tk_id reference of the new tab