Tom_Jung

Untitled

Mar 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. from guizero import App, TextBox, PushButton, Picture
  2. from pokebase import pokemon
  3. from requests import get
  4. from PIL import Image
  5. from io import BytesIO
  6.  
  7. def fetch_pokemon():
  8.  
  9. name = input_box.value
  10. poke = pokemon(name)
  11. pic = get(poke.sprites.front_default).content
  12. image = Image.open(BytesIO(pic))
  13. #image.save('poke.gif')
  14. image.save(name + '.gif')
  15. icon.value = 'poke.gif'
  16.  
  17. app = App(title = 'Pokemon Fetcher',width=500, height=200)
  18. input_box = TextBox(app, text ='Name')
  19. icon = Picture(app, image ="poke.gif")
  20. submit = PushButton(app,command =fetch_pokemon, text='Submit')
  21.  
  22. app.display()
Add Comment
Please, Sign In to add comment