Advertisement
Faiakes

Guizero-pokemon

Jun 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. from guizero import App, Text, TextBox, Box, 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.     name = input_box.value
  9.     poke = pokemon(name)
  10.     pic = get(poke.sprites.front_default).content
  11.     image = Image.open(BytesIO(pic))
  12.     image.save('poke.gif')
  13.     icon.value = 'poke.gif'
  14.     weight.value = "Weight is " + str(poke.weight)
  15.     height.value = "Height is " + str(poke.height)
  16.    
  17. app = App(title='Pokemon Fetcher', width=400, height=250)
  18.  
  19. input_box = TextBox(app, text='Name')
  20. icon = Picture(app, image="poke.gif")
  21. submit = PushButton(app, command=fetch_pokemon, text='Submit')
  22. height = Text(app)
  23. weight = Text(app)
  24.  
  25. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement