-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctkinter-test.py
More file actions
59 lines (40 loc) · 1.05 KB
/
ctkinter-test.py
File metadata and controls
59 lines (40 loc) · 1.05 KB
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
54
55
56
57
58
59
#!/usr/bin/env python3
#Created by PepeBigotes
from customtkinter import *
# MAIN WINDOW
root = CTk()
root.title("Testing CTkinter")
root.geometry("600x600")
# ACTIONS
def btn_func():
string = "the botton was pressed"
#print(string)
framelabel.configure(text=string)
def slider_func(x: float):
string = f"moved slider to {x}"
#print(string)
framelabel.configure(text=string)
switch_val = False
def switch_func():
global switch_val
switch_val = not switch_val
string = f"switch {'on' if switch_val else 'off'}"
#print(string)
framelabel.configure(text=string)
# WIDGETS
label = CTkLabel(root, text='hello world')
label.pack(pady=20)
button = CTkButton(root,
text='button',
command=btn_func)
button.pack(pady=20)
frame = CTkFrame(root)
frame.pack()
framelabel = CTkLabel(frame, text="This text will change if you click stuff")
framelabel.pack()
slider = CTkSlider(root, command=slider_func)
slider.pack(padx=10, pady=10)
switch = CTkSwitch(root, command=switch_func)
switch.pack()
# MAINLOOP
root.mainloop()