Tkinter CheatSheet
Tkinter CheatSheet
root.geometry(‘200x100’)
test = tk.Label(root, text=”pack(side=tk.bottom)”, bg=”teal”)
Tkinter Widgets test.pack(side=tk.bottom)
... ) Sizegrip 1
instance = ttk.Sizegrip(master,
Menubutton options, ... ) 1 2 3 4 5 6 7 8
instance = Menubutton ( master,
options, ... ) Treeview
instance = ttk.Treeview(master,
Tkinter Images with Pillow
PanedWindow options, ... ) # Pillow is imported as PIL
instance = PanedWindow(master, from PIL import ImageTk, Image
options, ... )
image1 = Image.open("<path/image_name>")
Radiobutton test = ImageTk.PhotoImage(image1)
instance = Radiobutton(master,
options, ... ) label1 = tkinter.Label(image=test)
label1.image = test
Scale
instance = Scale (master, option, ... # Position image as the background image
) label1.place(x=1, y=1)
# Resize image to fit on button
Scrollbar photoimage = photo.subsample(1, 2)
instance = Scrollbar ( master, # Position image on button
options, ... ) Button(root, image = photoimage,).pack(side = BOTTOM)