demos/demobase.py
changeset 96 68c562e0eb1f
parent 92 b97c4e25ed6d
--- a/demos/demobase.py	Fri Mar 28 14:58:12 2014 +0100
+++ b/demos/demobase.py	Fri Mar 28 14:58:20 2014 +0100
@@ -1,9 +1,13 @@
+# Path to root directory containing tuikit package
 import sys
 sys.path.append('..')
 
-import logging
+# Set system locale (needed for ncurses)
+import locale
+locale.setlocale(locale.LC_ALL, '')
 
 # Setup logging
+import logging
 logger = logging.getLogger('tuikit')
 logger.setLevel(logging.DEBUG)
 handler = logging.FileHandler(filename='tuikit.log')
@@ -11,3 +15,9 @@
 formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
 handler.setFormatter(formatter)
 logger.addHandler(handler)
+
+# Escape key code is also used for escape sequences. After escape code,
+# terminal waits for rest of sequence. This delay is 1 second by default.
+# Let's hope that our terminal is fast enough to handle the sequences in 200ms.
+import os
+os.environ['ESCDELAY'] = '200'