File size: 1,181 Bytes
7798609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""
title: Checkbox
"""

import simplestart as ss

ss.write("### ss.checkbox")

def onchange(event):
    ss.session["checked_value"] = event.value


ss.md('''
---
#### πŸ”… Example 1
''')

ss.md("onchange: @checked_value")

ss.checkbox("checkme", onchange = onchange)
ss.checkbox("initially checked", checked = True, onchange = onchange)


ss.write('''
---
#### πŸ”Ž Code
''')

ss.md('''
```python
import simplestart as ss

def onchange(state, value):
    state["checked_value"] = value

#ui
ss.md("onchange: @checked_value")

ss.checkbox("checkme", onchange = onchange)
ss.checkbox("initially checked", checked = True, onchange = onchange)


''')

ss.space()
ss.md('''
---
#### πŸ”… Example 2
Get the status of the checkbox
''')

mycheck = ss.checkbox("check me", onchange = onchange)

def myclick():
    ss.message(mycheck.value)

ss.button("Get Status", onclick = myclick)

ss.space()
ss.write('''
---
#### πŸ”Ž Code
''')


ss.md('''
```python
import simplestart as ss

mycheck = ss.checkbox("check me", onchange = onchange)

def myclick():
    ss.message(mycheck.value)

ss.button("θŽ·ε–ηŠΆζ€", onclick = myclick)

''')

def onPageLoad():
    ss.session["checked_value"] = ""