-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathstyle_widget.py
53 lines (42 loc) · 1.12 KB
/
style_widget.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Tkinter.com - Style Individual Widgets')
root.iconbitmap('c:/tkinter.com/images/codemy.ico')
root.geometry("500x350")
# Define a Style Widget
style = ttk.Style()
style.theme_use("default")
# Widget Style
style.configure('elder.TButton',
foreground="white",
background="#003066",
font=("Helvetica", 24),
padding=[10,10,10,10])
style.map('elder.TButton', background=[('active', '#004ea5')])
'''
Widget Style Names
Button: TButton
Checkbutton: TCheckbutton
Combobox: TCombobox
Entry: TEntry
Frame: TFrame
Label: TLabel
LabelFrame: TLabelFrame
Menubutton: TMenubutton
Notebook: TNotebook
PanedWindow: TPanedwindow
Progressbar: Horizontal.TProgressbar or Vertical.TProgressbar
Radiobutton: TRadiobutton
Scale: Horizontal.TScale or Vertical.TScale
Scrollbar: Horizontal.TScrollbar or Vertical.TScrollbar
Separator: TSeparator
Sizegrip: TSizegrip
Treeview: Treeview
'''
# Create some Buttons
my_button1 = ttk.Button(root, text="Login", style="elder.TButton")
my_button1.pack(pady=40)
my_button2 = ttk.Button(root, text="Exit")
my_button2.pack(pady=20)
root.mainloop()