Guest User

Untitled

a guest
Oct 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import ui
  2.  
  3. def button_tapped(sender):
  4. if sender.title == 'Hello':
  5. sender.title = 'Stop that!'
  6. #view.size_to_fit()
  7.  
  8. if sender.title == 'Tap me!':
  9. sender.title = 'Hello'
  10. #view.size_to_fit()
  11.  
  12.  
  13. view = ui.View() # [1]
  14. view.name = 'Demo' # [2]
  15. view.background_color = 'white' # [3]
  16. button = ui.Button(title='Tap me!') # [4]
  17. button.center = (view.width * 0.5, view.height * 0.5) # [5]
  18. button.flex = 'LRTB' # [6]
  19. button.action = button_tapped # [7]
  20. view.add_subview(button) # [8]
  21. view.present(style = 'sheet') # [
Add Comment
Please, Sign In to add comment