-
Notifications
You must be signed in to change notification settings - Fork 80
/
widget_default.py
42 lines (38 loc) · 980 Bytes
/
widget_default.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
from guizero import App, Text, TextBox, Slider, PushButton, Box
def change():
a.bg = "red"
tb.width = 20
t.height = 5
t.text_color = "blue"
t.font = "courier new"
t.text_size = 20
s.width = 150
p.width = 20
pb.width = 100
p.height = 2
pb.height = 100
b.bg = "white"
def reset():
# by setting a widget property to None it restores its original value
a.bg = None
tb.width = None
t.height = None
t.text_color = None
t.font = None
t.text_size = None
s.width = None
p.width = None
pb.width = None
p.height = None
pb.height = None
b.bg = None
a = App()
tb = TextBox(a)
s = Slider(a)
p = PushButton(a)
pb = PushButton(a, image="guizero.gif")
t = Text(a, "Widget settings")
b = Box(a, layout="grid")
change_button = PushButton(b, text="change", command=change, grid=[0,0], align="left")
reset_button = PushButton(b, text="reset", command=reset, grid=[1,0], align="right")
a.display()