test2023h5's picture
Upload 44 files
7798609 verified
'''
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)
```
''')