Advertisement
kalpin

Hero Generator Boxes

Aug 4th, 2020
1,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.33 KB | None | 0 0
  1. # Import the GUI widgets that you'll be using, and create the 'app' for your program.
  2. from guizero import App, Text, PushButton, TextBox, info,ButtonGroup,Combo,Picture,CheckBox,Box
  3.  
  4. app = App(title="Hero Name Generator", width="640", height="620", bg="white")
  5.  
  6.  
  7. # Function definitions for your events go here.
  8. def btn_go_clicked():
  9.     name = f"{bgAdjective1.value} {txt_colour.value} {bgAdjective2.value} {cbo_animal.value}"
  10.     lbl_hero.value = name
  11.    
  12.  
  13.  
  14. # Your GUI widgets go here
  15. boxImage = Box(app, align = 'top', width = 'fill')
  16. img1 = Picture(boxImage, image = "sh_small.jpg", align = "left")
  17.  
  18. box5 = Box(app, width = 'fill',height = 10, align = 'top')
  19. box5.bg='black'
  20.  
  21. box1 = Box(app, width = 'fill',height = 150, align='top' )
  22. boxAdjectives1 = Box(box1, align='left', width = 320, height = 150)
  23. boxAdjectives1.bg = 'honeydew'
  24. lblAdjective1  = Text(boxAdjectives1, text="ADJECTIVE 1",color = 'red')
  25. bgAdjective1  = ButtonGroup(boxAdjectives1, options=["Amazingly", "Smilingly", "Bouncingly","Dastardly"], )
  26.  
  27. box5 = Box(app, width = 'fill',height = 10, align = 'top')
  28. boxAdjectives2 = Box(box1, align='left', width = 320, height = 150)
  29. boxAdjectives2.bg = 'cyan'
  30. lblAdjective2  = Text(boxAdjectives2, text="ADJECTIVE 1",color = 'red')
  31. bgAdjective2  = ButtonGroup(boxAdjectives2, options=["amazing", "happy", "awesome","grumpy","smiley"])
  32.  
  33. box5 = Box(app, width = 'fill',height = 10, align = 'top')
  34. box2 = Box(app, width = 'fill',height = 50, align='top' )
  35. box2.bg = 'thistle1'
  36. lbl_colour = Text(box2,text="COLOUR",align="left",color='red',width=20)
  37. txt_colour = TextBox(box2, width=20, align="left")
  38. txt_colour.text_size = 14
  39. lbl_colour1 = Text(box2,text="type in your colour",align="left")
  40.  
  41. box5 = Box(app, width = 'fill',height = 10, align = 'top')
  42. box3 = Box(app, width = 'fill',height = 50, align='top' )
  43. box3.bg = 'paleturquoise1'
  44. lbl_animal = Text(box3,text="ANIMAL",align="left",width = 20)
  45. cbo_animal = Combo(box3, options=["Chicken", "Cow", "Sheep", "Lion","Monkey"],align="left",width = 40)
  46.  
  47. box5 = Box(app, width = 'fill',height = 10, align = 'top')
  48. box4 = Box(app, width = 'fill',height = 80, align='top' )
  49. box4.bg = 'white'
  50. btn_go = PushButton(box4, command=btn_go_clicked, width="30",text="Go")
  51. lbl_hero = Text(app,text=" ", color="red",size=24, width = 'fill' )
  52.  
  53.  
  54. # Show the GUI on the screen
  55. app.display()
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement