forked from npcole/npyscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pybug.py
executable file
·42 lines (35 loc) · 1.41 KB
/
pybug.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
40
41
#! /usr/bin/env python3
import sys
import npyscreen
class TestMenuForm(npyscreen.FormBaseNew):
def create(self):
self.Selection = self.add(npyscreen.TitleMultiSelect,
name="select",
values=["a","b","c"],
max_height=3,
scroll_exit=True)
self.messageBox = self.add(npyscreen.Pager,
name="Messages",
max_height=4,
editable=False)
def while_editing(self,arg):
if arg is self.Selection:
if len(arg.value) == 0:
self.messageBox.values = ["please select at least one",
arg.value,
len(arg.value)]
else:
self.messageBox.values = [repr(arg.value),
arg.value,
len(arg.value)]
self.messageBox.display()
npyscreen.notify_yes_no('Has this worked', editw=1)
class TestApp(npyscreen.NPSAppManaged):
def onStart(self):
testMenuForm = TestMenuForm(name="Selection")
self.registerForm('MAIN', testMenuForm)
def main(args):
App = TestApp()
App.run()
if __name__ == '__main__':
main(sys.argv)