Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, TextBox, 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')
- image.save(name + '.gif')
- icon.value = 'poke.gif'
- app = App(title = 'Pokemon Fetcher',width=500, height=200)
- input_box = TextBox(app, text ='Name')
- icon = Picture(app, image ="poke.gif")
- submit = PushButton(app,command =fetch_pokemon, text='Submit')
- app.display()
Add Comment
Please, Sign In to add comment