Académique Documents
Professionnel Documents
Culture Documents
Basic Level
https://engmrk.com Tk.Label, ttk.Label Display static text or image >>> treeview = ttk.Treeview ( root )
Tk.Message Display static multi line text
>>> treeview.pack ( )
>>> treeview.insert ( ‘ ‘, ‘item1’, text = ‘First item’)
The most commonly used GUI programming toolkit for Ttk.Separator Display a horizontal or vertical separator bar >>> treeview.insert ( ‘ ‘, ‘item2’, text = ‘Second item’)
Python. Ttk.Progressbar Show status of running operation
>>> treeview.cofig (height = 5, column = (‘Version’))
>>> treeview.column (‘Version’, width = 50, anchor = CENTER)
How to import? Ttk.Treeview Display hierarchical collection of items
>>> import tkinter or from tkinter import *
Create Cascading Menu
Widget (Grouping) Purpose
Application Main Window >>> root.option_add (‘*tearoff’, False)
Tk.Frame, ttk.Frame Displays set of widgets as one unit
>>> menubar = Menu (root)
How to instantiate main window of application? Ttk.LabelFrame Frame but with border and title >>> root.config (menu = menubar)
>>> root = Tk ( ) Tk.PanedWindow Group widgets in re-sizable panes
>>> file = Menu (menubar)
>>> edit= Menu (menubar)
Ttk.Notebook Tabbed set of frames, only one visible at a time >>> help_ = Menu (menubar)
Widgets >>> menubar.add_cascade (menu = file, label = ‘File’)
Import ‘generic’ widgets: >>> import tkinter Common Properties: >>> menubar.add_cascade (menu = edit, label = ‘Edit’)
background, foreground, width, height, borderwidth, text, >>> menubar.add_cascade (menu = help_, label = ‘Help’)
Import ‘styled’ widgets: >>> from tkinter import ttk >>> file.add_command (label = ‘New’, command = lambda: print(‘New
font, cursor, activeforeground, activebackground, image.
File’)
Widget (Interactive) Purpose Specific Properties: >>> file.add_separator ()
Ttk.Button, tk.Button Execute a command, function or task 1- Scale: from_ , to. orient, resolution. >>> file.entryconfig ( ‘New’, accelerator = ‘Ctrl + N’)