File size: 2,085 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 |
'''
title: Columns Layout
'''
import streamsync as ss
ss.md("## ss.columns Columns Layout")
ss.space()
ss.md("#### π
Example")
ss.space()
ss.md("### Average Spacing")
def onchange1(event):
#cols_ex1.design = True
cols_ex1_id = cols1[0].id
if event.value == True:
ss.getcm().components[cols_ex1_id]["content"]["options"]["border"] = True
ss.session["cols1_design"] = ', border = True'
else:
ss.getcm().components[cols_ex1_id]["content"]["options"]["border"] = False
ss.session["cols1_design"] = ''
ss.update_cm(cols_ex1_id)
ss.checkbox("border", checked = True, onchange = onchange1)
cols1 = ss.columns(2, border=True)
with cols1[0]:
ss.text("First of two columns")
with cols1[1]:
ss.text("Second of two columns")
ss.space()
ss.write("---")
ss.write("#### π Code")
ss.md('''
```python
import simplestart as ss
cols1 = ss.columns(2, border = True)
with cols1[0]:
ss.text("First of two columns")
with cols1[1]:
ss.text("Second of two columns")
```
''')
ss.space()
ss.md("### Proportional Spacing")
def onchange2(event):
#cols_ex1.design = True
cols_ex2_id = cols2[0].id
if event.value == True:
ss.getcm().components[cols_ex2_id]["content"]["options"]["border"] = True
ss.session["cols2_design"] = ', border = True'
else:
ss.getcm().components[cols_ex2_id]["content"]["options"]["border"] = False
ss.session["cols2_design"] = ''
ss.update_cm(cols_ex2_id)
ss.checkbox("border", checked = True, onchange = onchange2)
cols2 = ss.columns([4,6], border = True)
with cols2[0]:
ss.text("First of two columns")
with cols2[1]:
ss.text("Second of two columns")
ss.space()
ss.write("---")
ss.write("#### π Code")
ss.md('''
```python
import simplestart as ss
cols1 = ss.columns([4,6], border = True)
with cols1[0]:
ss.text("First of two columns")
with cols1[1]:
ss.text("Second of two columns")
```
''')
def onPageLoad():
ss.session["cols1_design"] = ''
ss.session["cols2_design"] = '' |