File size: 2,909 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
'''
title: Dialog
'''

import simplestart as ss

ss.md("## ss.dialog")

ss.space()

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

def testme():
    ss.message("testme")
    
def showit():
    if ss.session["str_fullscreen"] != "":
        dialog.show(fullscreen = True)
    else:
        dialog.show()
    
def myclose(event):
    ss.message("dialog close with result " + event.value)
    
dialog = ss.dialog("Dialog Title",  onclose=myclose)
with dialog:
    ss.text("SimpleStart dialog demostration")
    ss.md("---")
    ss.button("testme", onclick=testme)
    ss.md(":smile:")
        
cols = ss.columns([60,"flex:40; border-left:1px solid lightgray"], border=True, style="border:1px solid lightgray")
with cols[0]:
    mytext = ss.text("This is dialog")
    ss.button("show dialog", onclick=showit)
    
def mycheck(event):
    if event.value == True:
        ss.session["str_fullscreen"] = "fullscreen = True"
        #dialog.show(fullscreen = True)
    else:
        ss.session["str_fullscreen"] = ""

with cols[1]:
    ss.text("Dialog Options")
    ss.checkbox("Fullscreen", onchange=mycheck)

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

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

def myclose(event):
    ss.message("dialog close with result " + event.value)
    
dialog = ss.dialog(title="Dialog Title", onclose=myclose)
with dialog:
    ss.text("Opening from the bottom")
    ss.md("---")
    ss.button("testme", onclick=testme)
    ss.md(":smile:")
    
def showit():
    dialog.show(@str_fullscreen)
    
ss.button("show dialog", onclick=showit)
```
''')

def onPageEnter():
    ss.session["str_fullscreen"] = ""
    
    
ss.write("---")
ss.write("Other dialogs")

ss.md("## ss.alert show alert dialog")

def show_alert():
    ss.alert("Title", "The file will not be saved")
ss.button("alert", onclick=show_alert)

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

def show_alert():
    ss.alert("Title", "The file will not be saved")
    
ss.button("alert", onclick=show_alert)
```
''')

ss.md("## ss.confirm show confirm dialog")

def onconfirm(event):
    ss.message(event.value)

def show_confirm():
    ss.confirm("Title", "Are you sure? ", onconfirm)
    
ss.button("confirm", onclick=show_confirm)

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

def onconfirm(event):
    ss.message(event.value)

def show_confirm():
    ss.confirm("Title", "Are you sure? ", onconfirm)
    
ss.button("confirm", onclick=show_confirm)
```
''')


ss.md("## ss.prompt show prompt dialog")

def myclose(event):
    ss.message(event.value)
    
def show_prompt():
    ss.prompt("title", "please input the value", onclose = myclose)
    
ss.button("prompt", onclick=show_prompt)

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

def myclose(event):
    ss.message(event.value)
    
def show_prompt():
    ss.prompt("title", "please input the value", onclose = myclose)
ss.button("prompt", onclick=show_prompt) 
```
''')