You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a main menu that has as options scan the time and add it to a file if the numbers are even, on this same main menu I have an option that accesses a submenu that loads the file data to place them as options.
The problem I have is that if I add data to the file on execution when I try to enter the submenu it only shows me the options that the file had when I executed es script.py and not the ones that were added now. How can I make the submenu dynamic, that is, load the new values that were added to the file?
The text was updated successfully, but these errors were encountered:
Hi! I have the same problem, could you solve it? I see you can redraw the console with the method draw() but i can't make it to work or is not what I am looking for.
EDIT: After 5 minues reading the code I found where is the issue.
Well, its not an issue itself, but just the way in which the library is done.
The FunctionItem class inherits from ExternalItem which inherits from MenuItem.
In MenuItem is where the tet property is, and is the one that holds the string.
The string inside text is static. It will not change even thou we change a variable that was part of the text as buiding the menu:
ie: func_item = FunctionItem(f"Set minimun ratio[{config_parameters.min_ratio}]", set_ratio_threshole, [config_parameters])
I'll try to refactor the library and come up with a solution.
EDIT 2:
After 5 more minutes reading...
You can pass a Callable to the text argument. i.e:
I have created a main menu that has as options scan the time and add it to a file if the numbers are even, on this same main menu I have an option that accesses a submenu that loads the file data to place them as options.
The problem I have is that if I add data to the file on execution when I try to enter the submenu it only shows me the options that the file had when I executed es script.py and not the ones that were added now. How can I make the submenu dynamic, that is, load the new values that were added to the file?
The text was updated successfully, but these errors were encountered: