Button and "text to function" with python switch case like

another way to do a menu

it use one “mouse over any” and a “mouse left”,
linked to a “switch case”-like in a python module

the name of the object hit call a dict key,
and then the key call a function

there is also a “text to function” (i dont know how to call it), a keyboard input to executed a function
by example, you can exit game by enter the exit button name
python module here is almost the same

it is not easier than logics bricks alones but the python script is clear

it can be used in tkinter with button class too

here the .blend for Blender 2.79
menu_switch.blend (551.7 KB)

and here .blend for UPBGE
another version .blend
upbge_menu_switch.blend (600.3 KB)

“view to object” can view all object now
“list objects” print scene objects
“list text”, “property object” and “list light”…same way
“trans object float_value” change transparency

can be use in rts, point n click, menu

how to add function:
use “obj=cont.sensors[ “sensor_name” ].hitObject” ,".hitPosition",…etc or “own” as parameters to the function when this one is launched :

dict_name [ obj.name ] ( own, obj )

don’t forget to fill the dictionnary :
dict_name = { “object_name” : function_to_call }

in function, deal with object, using their references:

def my_func(own, obj) : scene.objects[ obj.name ].worldPosition…