Upload 11 files
Browse files
pages/002 Form Component/demo_button.py
CHANGED
@@ -1,18 +1,25 @@
|
|
1 |
### Button
|
2 |
-
import
|
3 |
-
|
4 |
|
5 |
ss.md('''
|
6 |
## ss.button
|
7 |
''')
|
8 |
ss.md('''
|
9 |
-
[Online Help](
|
10 |
''')
|
11 |
ss.space()
|
12 |
ss.md('''
|
13 |
#### π
Example
|
14 |
''')
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
#Custom Function
|
17 |
def myclick():
|
18 |
mytext.text = "You clicked "
|
|
|
1 |
### Button
|
2 |
+
import simplestart as ss
|
|
|
3 |
|
4 |
ss.md('''
|
5 |
## ss.button
|
6 |
''')
|
7 |
ss.md('''
|
8 |
+
[Online Help](https://www.simplestart.cc/doc_form/ss-button.html)
|
9 |
''')
|
10 |
ss.space()
|
11 |
ss.md('''
|
12 |
#### π
Example
|
13 |
''')
|
14 |
|
15 |
+
|
16 |
+
def testme():
|
17 |
+
#ss.openpage("002 Form Component/demo_button", lang="zh")
|
18 |
+
#ss.openpage("main", lang="zh")
|
19 |
+
ss.send_message("change_locale", {"locale":"zh"});
|
20 |
+
|
21 |
+
ss.button("testme", onclick = testme)
|
22 |
+
|
23 |
#Custom Function
|
24 |
def myclick():
|
25 |
mytext.text = "You clicked "
|
pages/002 Form Component/demo_menu.py
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Menu
|
2 |
+
import streamsync as ss
|
3 |
+
|
4 |
+
ss.md("## ss.menu")
|
5 |
+
|
6 |
+
ss.md('''
|
7 |
+
#### π
Example
|
8 |
+
''')
|
9 |
+
|
10 |
+
data = [
|
11 |
+
{'index': '1', 'title': 'Processing Center', 'icon':'mdi-home'},
|
12 |
+
{'type': 'spacer'}, #add spacer
|
13 |
+
{
|
14 |
+
'index': '2',
|
15 |
+
'title': 'Workspace',
|
16 |
+
'icon' : 'mdi-plus',
|
17 |
+
'subItems': [
|
18 |
+
{'index': '2-1', 'title': 'item one'},
|
19 |
+
{'index': '2-2', 'title': 'item two'},
|
20 |
+
{'index': '2-3', 'title': 'item three'},
|
21 |
+
{
|
22 |
+
'index': '2-4',
|
23 |
+
'title': 'item four',
|
24 |
+
'subItems': [
|
25 |
+
{'index': '2-4-1', 'title': 'item one'},
|
26 |
+
{'index': '2-4-2', 'title': 'item two'},
|
27 |
+
{'index': '2-4-3', 'title': 'item three'},
|
28 |
+
],
|
29 |
+
},
|
30 |
+
],
|
31 |
+
},
|
32 |
+
{'index': '3', 'title': 'Info', 'disabled': True, 'icon':'mdi-cancel'},
|
33 |
+
{'index': '4', 'title': 'Orders', 'icon':'mdi-wrench'},
|
34 |
+
]
|
35 |
+
|
36 |
+
def menu_select(event):
|
37 |
+
print("menu1")
|
38 |
+
ss.message(event.data["keyPath"])
|
39 |
+
|
40 |
+
|
41 |
+
ss.md("### Horiontal Menu")
|
42 |
+
ss.menu(data, direction = "horizontal", onselect = menu_select)
|
43 |
+
|
44 |
+
ss.space()
|
45 |
+
ss.md("### Vertical Menu")
|
46 |
+
|
47 |
+
ss.menu(data, direction = "vertical", dark = True, onselect = menu_select)
|
48 |
+
|
49 |
+
|
50 |
+
ss.space()
|
51 |
+
ss.write('''
|
52 |
+
---
|
53 |
+
#### π Code
|
54 |
+
''')
|
55 |
+
|
56 |
+
ss.md('''
|
57 |
+
```python
|
58 |
+
import simplestart as ss
|
59 |
+
|
60 |
+
data = [
|
61 |
+
{'index': '1', 'title': 'Processing Center', 'icon':'mdi-home'},
|
62 |
+
{'type': 'spacer'}, #add spacer
|
63 |
+
{
|
64 |
+
'index': '2',
|
65 |
+
'title': 'Workspace',
|
66 |
+
'icon' : 'mdi-plus',
|
67 |
+
'subItems': [
|
68 |
+
{'index': '2-1', 'title': 'item one'},
|
69 |
+
{'index': '2-2', 'title': 'item two'},
|
70 |
+
{'index': '2-3', 'title': 'item three'},
|
71 |
+
{
|
72 |
+
'index': '2-4',
|
73 |
+
'title': 'item four',
|
74 |
+
'subItems': [
|
75 |
+
{'index': '2-4-1', 'title': 'item one'},
|
76 |
+
{'index': '2-4-2', 'title': 'item two'},
|
77 |
+
{'index': '2-4-3', 'title': 'item three'},
|
78 |
+
],
|
79 |
+
},
|
80 |
+
],
|
81 |
+
},
|
82 |
+
{'index': '3', 'title': 'Info', 'disabled': True, 'icon':'mdi-cancel'},
|
83 |
+
{'index': '4', 'title': 'Orders', 'icon':'mdi-wrench'},
|
84 |
+
]
|
85 |
+
|
86 |
+
def menu_select(event):
|
87 |
+
print("menu1")
|
88 |
+
ss.message(event.data["keyPath"])
|
89 |
+
|
90 |
+
|
91 |
+
ss.md("### Horiontal Menu")
|
92 |
+
ss.menu(data, direction = "horizontal", onselect = menu_select)
|
93 |
+
|
94 |
+
ss.space()
|
95 |
+
ss.md("### Vertical Menu")
|
96 |
+
|
97 |
+
ss.menu(data, direction = "vertical", dark = True, onselect = menu_select)
|
98 |
+
|
99 |
+
```
|
100 |
+
''')
|