Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/1dcd378b803122f71ed5 to your computer and use it in GitHub Desktop.
Save RichardBronosky/1dcd378b803122f71ed5 to your computer and use it in GitHub Desktop.
import urwid
choices = u"""When I get to the bottom I go back to the top of the slide. Where I stop and I turn and I go for a ride. Till I get to the bottom and I see you again. Yeah yeah yeah hey.
Do you, don't you want me to love you. I'm coming down fast but I'm miles above you. Tell me tell me tell me come on tell me the answer. Well you may be a lover but you ain't no dancer.
Now helter skelter helter skelter. Helter skelter yeah. Ooh!
Will you, won't you want me to make you. I'm coming down fast but don't let me break you. Tell me tell me tell me the answer. You may be a lover but you ain't no dancer.
Look out helter skelter helter skelter. Helter skelter ooh.
Look out, cos here she comes.
When I get to the bottom I go back to the top of the slide. And I stop and I turn and I go for a ride. And I get to the bottom and I see you again. Yeah yeah yeah.
Well do you, don't you want me to make you. I'm coming down fast but don't let me break you. Tell me tell me tell me the answer. You may be a lover but you ain't no dancer.
Look out helter skelter helter skelter. Helter skelter.
Look out helter skelter. She's coming down fast. Yes she is. Yes she is coming down fast.""".split('\n')
def menu(title, choices):
body = [urwid.Text(('banner', title), align='center'), urwid.Divider()]
for i, c in enumerate(choices):
button = urwid.Button(c)
urwid.connect_signal(button, 'click', item_chosen, c)
body.append(urwid.AttrMap(button, ('odd', 'even')[i%2], focus_map='higlighted'))
return urwid.ListBox(urwid.SimpleFocusListWalker(body))
def item_chosen(button, choice):
#from pudb import set_trace; set_trace()
main_menu.body[main_menu.body.focus] = urwid.AttrMap(button, 'used', focus_map='higlighted')
main_menu.body.set_focus(main_menu.body.next_position(main_menu.body.get_focus()[1]))
main_menu.body._modified()
pass
def exit_program(button):
raise urwid.ExitMainLoop()
main_menu = menu(u'Helter Skelter', choices)
main = urwid.Padding(main_menu, left=2, right=2)
palette=[
('higlighted', 'black', 'dark red'),
('used', 'black', 'dark blue'),
('odd', 'light gray', 'black'),
('even', 'light gray', 'dark gray'),]
urwid.MainLoop(main, palette).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment