Initial tests with curses
authorJohn Ladan <jladan@uwaterloo.ca>
Fri, 9 Mar 2012 21:28:38 +0000 (16:28 -0500)
committerJohn Ladan <jladan@uwaterloo.ca>
Fri, 9 Mar 2012 21:28:38 +0000 (16:28 -0500)
cursestest.py [new file with mode: 0755]

diff --git a/cursestest.py b/cursestest.py
new file mode 100755 (executable)
index 0000000..6ba6eb2
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import curses
+
+
+def showBold(stdscr):
+    stdscr.addstr("Type any character to see it in bold\n")
+    ch = stdscr.getch()
+
+    if (ch==curses.KEY_F1):
+        stdscr.addstr("F1 Key pressed")
+
+    else:
+        stdscr.addstr("The key pressed is ")
+        stdscr.addch(ch, curses.A_BOLD)
+
+        stdscr.refresh()
+        stdscr.getch()
+
+curses.wrapper(showBold)