summaryrefslogtreecommitdiffstats
path: root/cursed.py
diff options
context:
space:
mode:
Diffstat (limited to 'cursed.py')
-rw-r--r--cursed.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/cursed.py b/cursed.py
new file mode 100644
index 0000000..754d91a
--- /dev/null
+++ b/cursed.py
@@ -0,0 +1,19 @@
+import curses
+
+
+def start(on_str, on_tab):
+ def main(stdscr):
+ curses.noecho()
+ curses.cbreak()
+ stdscr.keypad(True)
+ string = ""
+ while True:
+ char = stdscr.getkey()
+ if char == '\n':
+ on_str(string)
+ string = ""
+ elif char == '\t':
+ on_tab()
+ else:
+ string += char
+ curses.wrapper(main)