Python: Menu

Create up to four images that represent the states of your menu item 'New Game'. The tool egg-texture-cards takes your four images (ready, click, rollover and disabled) and converts it into an egg that can be used for the DirectButton.

Then in the command prompt use the following command:

egg-texture-cards -o btn_newgame.egg -p 240,240 btn_newgame.png btn_newgame_over.png btn_newgame_over.png btn_newgame.png

In your script add a button:

# Callback function to set  text
def doIt():
   # load the game
 
# Add New Game button
map = loader.loadModel('res/menu/btn_start_game')
self._bNew = DirectButton (
    pos = (0, 0, .15),
    geom = (
        map.find('**/btn_newgame'),
        map.find('**/btn_newgame_over'),
        map.find('**/btn_newgame_over'),
        map.find('**/btn_newgame')
    ),
    relief = None,
    geom_scale = (0.3),
    command=self.__doIt
)
Navigation
Print/export
Toolbox