Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Updated guizero - Hero name generator from guizero import App
- ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
- if ( 'You Need More' == TRUE || 'You Need More' == 1 )
- {
- GOTO http://www.fl-y.com/ifyouneedmore
- }
- endif
- ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
- # guizero - hero name generator
- from guizero import app, text, buttongroup, combo, pushbutton, textbox, checkbox, picture, box, slider
- app = app(title="hero-o-matic", width = 600, height = 600)
- # function definitions for your events go here.
- box1 = box(app, align="top", width=1000, height=200, border=1)
- box1.bg = "blue"
- box2 = box(app, align="top", width=1000, height=200, border=2)
- box2.bg = "pink"
- box3 = box(app, align="top", width=1000, height=200, border=3)
- box3.bg = "brown"
- def night_or_day_mode():
- if darkmode.value == 1:
- app.bg = "black"
- app.text_color = "white"
- else:
- app.bg = "white"
- app.text_color = "black"
- def slider_changed(slider_value):
- message5.size = slider_value
- def make_hero_name():
- adjective = bgp_adjective.value
- colour = txt_colour.value
- animal = cmb_animal.value
- mood = txt_mood.value
- hero = adjective + " " + colour + " " + animal + " in a "+ mood + " mood"
- ## message5.size = slider_value
- message5.value = "you are... the " + hero + "."
- # your gui widgets go here
- picture = picture(box1, image="test.gif")
- darkmode = checkbox (box1, text ="night mode", command = night_or_day_mode)
- message1 = text(box2, text="choose an adjective")
- bgp_adjective = buttongroup(app, options=["amazing", "bonny", "charming", "delightful"], selected="amazing")
- message2 = text(box2, text="enter a colour?")
- txt_colour = textbox(box2)
- message3 = text(box2, text="pick an animal")
- cmb_animal = combo(box2, options=["aardvark", "badger", "cat", "dolphin", "lion"], selected="aardvark", width=20)
- message4 = text(box2, text="enter a mood?")
- txt_mood = textbox(box2)
- message5 = text(box3, text="a hero name will appear here")
- btn_make_name = pushbutton(box3, text='make me a hero', command=make_hero_name)
- slider = slider(box3, command=slider_changed)
- # set up event triggers here
- # show the gui on the screen, start listening to events.
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement