Skip to content

Instantly share code, notes, and snippets.

@jbking
Last active August 29, 2015 14:04
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 jbking/9cc65065d8cb862d66d9 to your computer and use it in GitHub Desktop.
Save jbking/9cc65065d8cb862d66d9 to your computer and use it in GitHub Desktop.
Counter
# coding: utf-8
import ui
v = ui.load_view('Untitled')
i = 0
lbl = v['label1']
def btn_action(sender):
global i
i += 1
lbl.text = str(i)
btn = v['button1']
btn.action = btn_action
if ui.get_screen_size()[1] >= 768:
# iPad
v.present('popover')
else:
# iPhone
v.present(orientations=['portrait'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment