The menu() fonction is called with the element list, wich contain all the elements of the interactive menu.
Then, it return the result of the interaction with the user.
Syntaxe : menu ( position x, position y, elements list , <text color> , <background color> )
Exemple :
elements=[ ["btn" , "Button"], ["lst" , "List" , ("Michel" , "Francis" , "Me") , 1], ["sld" ,"Slider" , (1,99) ,1 ]] get_action = menu ( 10 , 10 , elements ) #optionnal : < text color >, < background color > if get_action[1] ["List"] == 0 : #the index refers to the fisrt element : "Michel" print( "your name is michel")
| Type | ID | Syntaxe | Annotation |
|---|---|---|---|
| Button | “btn” | ["btn","name"] |
Simple button. Not intended to be used as a text |
| List | “lst” | ["lst","name",("element1","element2"),current element index] |
Element that allow the user making a choice beetwen the different elements purposed |
| Slider | “sld” | ["sld","name",(min val,max val),current value] |
Element that allow the user chosing a value bettwen min val and max val |
The menu return a list :
[ "< name of the Button pressed >" , { "< name of slider/list 1 >": value/index 1 , "< name of slider/list 2 >": value/index 2 } ]