-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (25 loc) · 904 Bytes
/
main.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
counter = 0
pyscript.write('pyscript_status', 'PyScript Loaded Successfully')
def increase_counter(*ags, **kws):
global counter
counter += 1
button = Element('clicks')
# button.element.innerHTML = f"Count {counter}"
button.element.innerHTML = f"Count <strong>{counter}</strong>"
def toggle_text(*ags, **kws):
text = Element('toggle_text')
button = Element('toggle')
if "hidden" in text.element.classList:
text.remove_class("hidden")
button.element.innerHTML = "Hide Text"
else:
text.add_class("hidden")
button.element.innerHTML = "Show Text"
class Test():
def __init__(self) -> None:
self.counter = 0
self.text_element = Element('clicks_class')
def inc(self, *ags, **kws):
self.counter += 1
self.text_element.element.innerHTML = f"Count <strong>{self.counter}</strong>"
test_class = Test()