-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathB_Label.py
36 lines (24 loc) · 891 Bytes
/
B_Label.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
from DemoFramework import DemoFramework
from LUILabel import LUILabel
import random
f = DemoFramework()
f.prepare_demo("LUILabel")
# Constructor
f.add_constructor_parameter("text", "Label")
f.add_constructor_parameter("shadow", "True")
f.add_constructor_parameter("font_size", "14")
f.add_constructor_parameter("font", "'label'")
# Functions
f.add_public_function("get_text", [], "string")
f.add_public_function("set_text", [("text", "string")])
f.add_property("text", "string")
f.add_property("text_handle", "LUIText")
# Events
f.construct_sourcecode("LUILabel")
# Create a new label
label = LUILabel(parent=f.get_widget_node(), text="This is a fancy label")
f.set_actions({
"Set Random Text": lambda: label.set_text(str(random.randint(100, 10000))),
"Set Random Color": lambda: label.set_color(random.random(), random.random(), random.random(), 1)
})
run()