Advertisement
JDpaste

Python GUI guizero: FULL SCREEN resize

Oct 2nd, 2019
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. # Under 'PushButton control', this demo resizes (and colours) the h1 heading
  2. # and switches in and out of FULL SCREEN mode
  3. from guizero import App, Text, Box, PushButton
  4.  
  5. app = App(title="REsize")
  6. app.bg ="cyan"
  7.  
  8. fullSize = True #
  9.  
  10. def changeSize():
  11.     global fullSize
  12.     fullSize = not(fullSize) # toggle
  13.    
  14.     if (fullSize):
  15.         sizingButton.text = "EXIT Full Screen mode"
  16.         h1.text_size = 30
  17.         h1.width = 40
  18.         h1.text_color = "red"
  19.         app.set_full_screen()
  20.     else:
  21.         sizingButton.text = "ENTER Full Screen mode"
  22.         h1.text_size = 20
  23.         h1.width = 26
  24.         h1.text_color = "black"
  25.         app.exit_full_screen()
  26.        
  27.  
  28. vertSpace01 = Text(app, text=" ", width="fill", size=12 )
  29. h1 = Text(app, text="Header text - resizes", align="top")
  30. h1.bg = "white"
  31.  
  32. box1 = Box(app)
  33. box1.bg = "#FE3456"
  34.  
  35. a_text = Text(box1, text="Same size ..?", align="bottom")
  36. sizingButton = PushButton(app, text='GO !', command= changeSize )
  37. sizingButton.bg = "#EE66EE"
  38. sizingButton.text_color = "white"
  39. sizingButton.text_size = 20
  40.  
  41. changeSize() # set initial config
  42. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement