Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Picture, ListBox, CheckBox, Combo, TextBox, PushButton, Text, info
- app = App(title="Super-hero", width=500, height=500)
- # black background
- # app.bg="black"
- # app.text_color="white"
- # white background
- lbl_intro1 = Text(app, text = 'superhero name')
- lbl_intro1.text_size = 25
- lbl_intro1.text_color = 'darkblue'
- picture = Picture(app, image="C:/Users/Admin/Future learning/st.jpg")
- picture.width=400
- picture.height=200
- def btn_go_clicked():
- info("Hero name created" , "Hero name is: " + txt_adj.value + " " + txt_color.value + " " + txt_animal.value + ".")
- def color_mode():
- if dmode.value == 1:
- app.bg = "black"
- app.text_color = "white"
- else:
- app.bg = "light yellow"
- app.text_color = "black"
- dmode = CheckBox(app, text="Dark mode", command=color_mode)
- lbl_adj = Text(app, text="What is your favorit character?")
- txt_adj = ListBox(app, items= ["Generous", "Amazing", "Fearless", "Resistant", "Angry"], multiselect = False)
- txt_adj.height = 5
- lbl_color = Text(app, text="What is your favorit color?")
- txt_color = TextBox(app)
- lbl_animal = Text(app, text="Select one of your favorit animals?")
- txt_animal = Combo(app, options=["Dragon", "Eagle", "Rabit", "Dog", "Elephant", "Lion", "Mouse", "Ant", "Bug", "Ladybird"])
- btn_go = PushButton(app, command=btn_go_clicked, text="Create")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement