-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathEXAMPLE-WIDGETLIST.py
More file actions
executable file
·24 lines (22 loc) · 918 Bytes
/
EXAMPLE-WIDGETLIST.py
File metadata and controls
executable file
·24 lines (22 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
import npyscreen
#npyscreen.disableColor()
class ActionFormExample(npyscreen.ActionForm):
initialWidgets = [
(npyscreen.TitleText, {'w_id': 'TextLine', 'name': "Text:"}),
(npyscreen.TitleFilename, {'name' : "Filename:"}),
(npyscreen.TitleFilename, {'name' : "Filename:"}),
(npyscreen.TitleDateCombo, {'name' : "Date:"}),
(npyscreen.TitleSlider, {'out_of': 12, 'name' : "Slider"}),
(npyscreen.MultiLineEdit, {'value' : """try typing here!\nMutiline text, press ^R to reformat.\n""", 'max_height': 5,})
]
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 = ActionFormExample(name = "Welcome to Npyscreen",)
F.edit()
return F.get_widget('TextLine').value
if __name__ == "__main__":
App = TestApp()
print(App.run())