def index(): pkmnNum = random.randint(1, 807) pkmnSprite = pb.pokemon_sprite(pkmnNum) pkmnName = pb.pokemon(pkmnNum) im = pkmnSprite.path pkmnImage = (im.split('/')[7]) dex = pb.pokemon_species(pkmnNum) #API info sent to html page pkmnInfo = [ dex.generation, pkmnName.weight, pkmnName.height, dex.habitat, pkmnName.types[0].type ] # Move path of cached sprite to static folder (may need to change second argument to full path based on user setup) os.rename(im, "/static/" + pkmnImage) return ''' <html> <head> <title>Pokemon</title> </head> <body> <center><h1 style = "font-family:'Helvetica Neue';font-size:50px;font-style:bold;">''' + str( pkmnName).capitalize() + '''</h1></center> <center><img src= "/static/''' + str(pkmnNum).capitalize( ) + '''.png" style="width:270px;height:270px;"></center> <center><p style = "font-family:'Helvetica Neue';font-size:20px;font-style:bold;"> <br> Generation: ''' + str(pkmnInfo[0]) + ''' <br> Weight: ''' + str(pkmnInfo[1]) + ''' <br> Height: ''' + str(pkmnInfo[2]) + ''' <br> Habitat: ''' + str(pkmnInfo[3]) + ''' <br> Type: ''' + str(pkmnInfo[4]) + '''
def findPokemon(num): poke = pokebase.pokemon(num) info = {} info["Name"] = poke info["Height"] = poke.height info["Sprite"] = pokebase.pokemon_sprite(num).path return info
def checkForPokemon(): keys = pygame.key.get_pressed() routePokemon = [4, 7, 1, 6, 10] if keys[pygame.K_UP] or keys[pygame.K_DOWN] \ or keys[pygame.K_LEFT] or keys[pygame.K_RIGHT]: playerNum = random.randrange(1, 101) if playerNum in routePokemon: enemy = pb.pokemon_sprite(playerNum) enemy = enemy.path #print(playerNum) #print(enemy) enemy = pygame.image.load(enemy) #pokemonBattle(enemy) fightScene(enemy, playerNum)
def _createPokemon_(dbValue): sprite = pygame.image.load(pb.pokemon_sprite(dbValue).path) return sprite, pb.pokemon(dbValue)
def setUp(self): self.bulba = pb.pokemon_sprite(1) self.doesnt_exists = pb.pokemon_sprite(-1)
import pokebase as pb chesto = pb.NamedAPIResource('berry', 'chesto') print(chesto.name) print(chesto.natural_gift_type.name) charmander = pb.pokemon('charmander') print(charmander.height) print(charmander.abilities[1]) bulba = pb.pokemon_sprite(1) # And sprites too! print(bulba.path)