Menu

NEW_MAIN_EXAMPLE

Benedict Jäggi

MAIN - The new way of doing it.

The new way requires two files to run:
AppList.json and MAIN.py (and all the Apps, of course.)

In AppList.json are all the modules listed like if you import them.

The Path is relative to the main file and you need points (.) instead of slashes (/).

Here is an example:

AppList.json

{
   "Apps": [
       "Apps.APP_Draw",
       "Apps.Games.APP_GAME_TicTacToe",
        ...
   ]
}

And then in the main file, you just need to call "initialize" and then you can create a menu with the apps:

MAIN.py

import APP_BASE
import APP_MENU

APP_BASE.initialize() # this imports all apps listed in AppList.json
mainMenu=APP_MENU.createAppMenu() # this creates a menu with the imported Apps.

APP_MENU.CURRENT_MENU=mainMenu
APP_BASE.setCurrentApp("APP_MENU")

running=True
while running==True:
     running=APP_BASE.update()

APP_BASE.quit()

If you know how MAIN.py works now, learn how to create one of these shiny Apps for yourself with the [APP_TEMPLATE].


Related

Wiki: APP_TEMPLATE

MongoDB Logo MongoDB