Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, TextBox, Box, PushButton, Picture
- from pokebase import pokemon
- from requests import get
- from PIL import Image
- from io import BytesIO
- def fetch_pokemon():
- name = input_box.value
- poke = pokemon(name)
- pic = get(poke.sprites.front_default).content
- image = Image.open(BytesIO(pic))
- image.save('poke.gif')
- icon.value = 'poke.gif'
- weight.value = "Weight is " + str(poke.weight)
- height.value = "Height is " + str(poke.height)
- app = App(title='Pokemon Fetcher', width=400, height=250)
- input_box = TextBox(app, text='Name')
- icon = Picture(app, image="poke.gif")
- submit = PushButton(app, command=fetch_pokemon, text='Submit')
- height = Text(app)
- weight = Text(app)
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement