I am working on a simple game on Python using module pygame. I made a menu, where user can choose a character for the game.
When the program is running, the names of the characters are displayed one by one, so user can choose a character for the game by using clicking, but I would also like to add a picture of the character himself under his name. I dont know how to do it, please help
Sorry for my English, I dont really good in it, but I hope you understand whats the problem. Thanks a lot.
This is a part of my code with menu:
def set_hero(value, difficulty):
global skin_h
print(value, difficulty)
if difficulty == 1:
skin_h = 'images\чп.png'
elif difficulty == 2:
skin_h = 'images\iron man.png'
elif difficulty == 3:
skin_h = 'images\A usa man.png'
elif difficulty == 4:
skin_h = 'images\dead pool.png'
global skin_h
pygame.init()
surface = pygame.display.set_mode((700, 700))
mainmenu = pygame_menu.Menu('Welcome', 700, 700, theme=themes.THEME_SOLARIZED)
mainmenu.add.button('Choose your character ', character_menu)
skin_h = 'images\чп.png'
skins_h = pygame_menu.Menu('Select a Character', 700, 700, theme=themes.THEME_BLUE)
skins_h.add.selector('Character :',
[('Spider man', 1), ('Iron man', 2), ('Captain America', 3), ('Dead Pool', 4)],
onchange=set_hero)
mainmenu.add.button('Play', start_the_game)
mainmenu.mainloop(surface)
I made a menu, so user can choose a character, but I cant put a picture of him under his name I dont know how to add a picture in selector