forked from npcole/npyscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXAMPLE-multipage_experimental.py
executable file
·39 lines (31 loc) · 1.48 KB
/
EXAMPLE-multipage_experimental.py
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
#!/usr/bin/env python
# encoding: utf-8
import npyscreen
#npyscreen.disableColor()
class TestApp(npyscreen.NPSApp):
def main(self):
# These lines create the form and populate it with widgets.
# A fairly complex screen in only 8 or so lines of code - a line for each control.
F = npyscreen.FormMultiPageActionWithMenus(name = "Welcome to Npyscreen",)
t = F.add(npyscreen.TitleText, name = "Text:",)
fn = F.add(npyscreen.TitleFilename, name = "Filename:")
dt = F.add(npyscreen.TitleDateCombo, name = "Date:")
s = F.add(npyscreen.TitleSlider, out_of=12, name = "Slider")
# The new page is created here.
new_page = F.add_page()
ml= F.add(npyscreen.MultiLineEdit,
value = """try typing here!\nMutiline text, press ^R to reformat.\n""",
max_height=5,)
ms= F.add(npyscreen.TitleSelectOne, max_height=4, value = [1,], name="Pick One",
values = ["Option1","Option2","Option3"], scroll_exit=True)
ms2= F.add(npyscreen.TitleMultiSelect, max_height =-2, value = [1,], name="Pick Several",
values = ["Option1","Option2","Option3"], scroll_exit=True)
F.switch_page(0)
def on_ok():
npyscreen.notify_confirm("OK Button Pressed!")
F.on_ok = on_ok
# This lets the user play with the Form.
F.edit()
if __name__ == "__main__":
App = TestApp()
App.run()