Advertisement
mrFitzpatrick

TowerBuilder

Aug 10th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. from guizero import Box, App, PushButton, TextBox, Text, Slider
  2.  
  3. #main app
  4. app = App()
  5.  
  6. #function
  7. def refresh():
  8.     box_header.width = sld_size.value
  9.     box_header.height = sld_size.value
  10.     box_body.width = box_header.width * 2
  11.     box_body.height = box_header.height * 2
  12.     box_footer.width = box_body.width * 2
  13.     box_footer.height = box_body.height * 2
  14.     box_four.width = box_footer.width * 2
  15.     box_four.height = box_footer.height * 2
  16.     app.height = 100 + box_header.height + box_body.height + box_footer.height + box_four.height
  17.  
  18. #widgets
  19. lbl_size = Text(app, text="Choose a size for your tower (1-5):")
  20. sld_size = Slider(app, start=1, end=50, width="fill", height=20)
  21. btn_refresh = PushButton(app, text="refresh", command=refresh)
  22.  
  23. #three boxes
  24. box_header = Box(app, align="top", border=0)
  25. box_header.bg = "dark blue"
  26.  
  27. box_body = Box(app, align="top", border=0)
  28. box_body.bg = "blue"
  29.  
  30. box_footer = Box(app, align="top", border=0)
  31. box_footer.bg = "sky blue"
  32.  
  33. box_four = Box(app, align="top", border=0)
  34. box_four.bg = "light blue"
  35.  
  36.  
  37. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement