-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 938 Bytes
/
main.py
File metadata and controls
33 lines (25 loc) · 938 Bytes
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
from pyscript import document
counter = 0
document.getElementById('pyscript_status').textContent = 'PyScript Loaded Successfully'
def increase_counter(*ags, **kws):
global counter
counter += 1
button = document.getElementById('clicks')
button.innerHTML = f"Count <strong>{counter}</strong>"
def toggle_text(*ags, **kws):
text = document.getElementById('toggle_text')
button = document.getElementById('toggle')
if "hidden" in text.classList:
text.classList.remove("hidden")
button.innerHTML = "Hide Text"
else:
text.classList.add("hidden")
button.innerHTML = "Show Text"
class Test():
def __init__(self) -> None:
self.counter = 0
self.text_element = document.getElementById('clicks_class')
def inc(self, *ags, **kws):
self.counter += 1
self.text_element.innerHTML = f"Count <strong>{self.counter}</strong>"
test_class = Test()