Advertisement
jolgri

Assignment5

Dec 10th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. from guizero import App, Picture, ListBox, CheckBox, Combo, TextBox, PushButton, Text, info
  2.  
  3. app = App(title="Super-hero", width=500, height=500)
  4. # black background
  5. # app.bg="black"
  6. # app.text_color="white"
  7. # white background
  8.  
  9. lbl_intro1 = Text(app, text = 'superhero name')
  10. lbl_intro1.text_size = 25
  11. lbl_intro1.text_color = 'darkblue'
  12.  
  13. picture = Picture(app, image="C:/Users/Admin/Future learning/st.jpg")
  14. picture.width=400
  15. picture.height=200
  16.  
  17.  
  18. def btn_go_clicked():
  19. info("Hero name created" , "Hero name is: " + txt_adj.value + " " + txt_color.value + " " + txt_animal.value + ".")
  20.  
  21. def color_mode():
  22. if dmode.value == 1:
  23. app.bg = "black"
  24. app.text_color = "white"
  25. else:
  26. app.bg = "light yellow"
  27. app.text_color = "black"
  28.  
  29. dmode = CheckBox(app, text="Dark mode", command=color_mode)
  30.  
  31. lbl_adj = Text(app, text="What is your favorit character?")
  32. txt_adj = ListBox(app, items= ["Generous", "Amazing", "Fearless", "Resistant", "Angry"], multiselect = False)
  33. txt_adj.height = 5
  34.  
  35. lbl_color = Text(app, text="What is your favorit color?")
  36. txt_color = TextBox(app)
  37.  
  38. lbl_animal = Text(app, text="Select one of your favorit animals?")
  39. txt_animal = Combo(app, options=["Dragon", "Eagle", "Rabit", "Dog", "Elephant", "Lion", "Mouse", "Ant", "Bug", "Ladybird"])
  40.  
  41. btn_go = PushButton(app, command=btn_go_clicked, text="Create")
  42.  
  43. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement