Last active
December 30, 2015 21:19
-
-
Save dheaney/7886386 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urwid | |
| def show_or_exit(key): | |
| if key in ('q', 'Q'): | |
| raise urwid.ExitMainLoop() | |
| txt.set_text(repr(key)) | |
| banner = u""" | |
| ____ __ __ __ | |
| / __ \__ __/ /_/ /_ ________ ____ _/ /__ | |
| / / / / / / / __/ __ \/ ___/ _ \/ __ `/ //_/ | |
| / /_/ / /_/ / /_/ /_/ / / / __/ /_/ / ,< | |
| \____/\__,_/\__/_.___/_/ \___/\__,_/_/|_| | |
| ===========================================""" | |
| description = u"Press any key to continue" | |
| copyright = u"Copyright 2013 David Heaney" | |
| banner = urwid.Text(('banner', banner), 'center') | |
| description = urwid.Text(('description', description), 'center') | |
| copyright = urwid.Text(('copyright', copyright), 'center') | |
| blank = urwid.Text("") | |
| pile = urwid.Pile([banner, copyright, blank, blank, blank, blank, description]) | |
| top = urwid.Filler(pile) | |
| try: | |
| urwid.MainLoop(top, unhandled_input=show_or_exit).run() | |
| except: | |
| os.system('cls' if os.name=='nt' else 'clear') | |
| while True: | |
| print "hello" | |
| for (i, t) in enumerate(("one", "two", "three")): | |
| print i + 1, t | |
| choice = int(raw_input("Choose one: ")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment