Page 1 of 1

Menu questions

Posted: Wed Feb 24, 2016 10:38 pm
by decompile
Hey,

Im currently working with the menus and i have a question about it.

In the select_callback

Syntax: Select all

def sometestcallback(menu, player_index, choice):


I dont understand how i can get the integer, seems like choice is a object.

2nd:
When i return menu, will the menu be re-created or is the menu saved in sometihng like a cache and instantly shown?

3rd:
Is menu.text needed? I see from the forum example its used there, but from some scripts its just simply "menu.append("text123")

Sorry mobile grammar

Posted: Thu Feb 25, 2016 6:11 am
by Ayuto
Choice is either a SimpleOption or a PagedOption object. It depends on the menu type you are using. Type help(choice) for more information.

Returning a menu works in the same way like sending a menu. The only difference is that it will be added to the beginning of the menu queue. Thus, it gets displayed instantly. The menus package doesn't cache anything.

I guess you mean the Text class. It's not necessary to use it. It's actually only useful if you plan to subclass it and override the render method.