-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtext.py
More file actions
35 lines (28 loc) · 1.1 KB
/
Copy pathtext.py
File metadata and controls
35 lines (28 loc) · 1.1 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
import httpx
import pyui
class TextTest(pyui.View):
line = pyui.State(default="")
lines = pyui.State(default="")
text = pyui.State(default="")
async def built(self):
async with httpx.AsyncClient() as client:
params = {"type": "meat-and-filler", "format": "text", "paras": 2}
r = await client.get("https://baconipsum.com/api/", params=params)
self.text = r.text
def content(self):
yield pyui.VStack(alignment=pyui.Alignment.LEADING)(
pyui.Text("Enter some text below:"),
pyui.TextField(self.line, placeholder="Single line text"),
pyui.TextField(self.lines, placeholder="Two line text input").lines(2),
pyui.TextField(self.text, placeholder="All the text")
.lines(None)
.priority("high"),
pyui.HStack()(
pyui.Spacer(),
pyui.Button("Submit", asset="button.primary"),
),
).padding(20)
if __name__ == "__main__":
app = pyui.Application("io.temp.TextTest")
app.window("Text Tester", TextTest())
app.run()