forked from phenom4n4n/TagScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplayground.py
More file actions
38 lines (32 loc) · 1.05 KB
/
Copy pathplayground.py
File metadata and controls
38 lines (32 loc) · 1.05 KB
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
from typing import Any, List, Optional
from appJar import gui as GUI
import TagScriptEngine as tse
from TagScriptEngine import Interpreter, block
blocks: List[tse.Block] = [
block.MathBlock(),
block.RandomBlock(),
block.RangeBlock(),
block.AnyBlock(),
block.IfBlock(),
block.AllBlock(),
block.BreakBlock(),
block.StrfBlock(),
block.StopBlock(),
block.AssignmentBlock(),
block.FiftyFiftyBlock(),
block.ShortCutRedirectBlock("message"),
block.LooseVariableGetterBlock(),
block.SubstringBlock(),
]
x: Interpreter = Interpreter(blocks)
def press(button: Any) -> None:
o: Optional[str] = x.process(app.getTextArea("input")).body
app.clearTextArea("output")
app.setTextArea("output", o)
app: GUI = GUI("TSE Playground", "750x450")
app.setPadding([2, 2])
app.setInPadding([2, 2])
app.addTextArea("input", text="I see {rand:1,2,3,4} new items!", row=0, column=0)
app.addTextArea("output", text="Press process to continue", row=0, column=1)
app.addButton("process", press, row=1, column=0, colspan=2)
app.go()