menu
This function is used to allow the user to pick from a list of items.
You can pass a dictionary instead of a list, for when you're doing special formatting.
Initialization
It's a simple function call. It is blocking, and returns the user's choice. When the choices argument is a dictionary though, things are different. I'll explain that in a bit.
This would return the string the user picked, for example, "Choice 1"
Using dictionaries instead of lists
When using special, dynamic formatting, returning the raw string the user picked is not very useful.
Of course, you can always figure something out, but that's a dirty workaround. Using dictionaries is a much easier way, with no workarounds. It shows the key to the user, but returns the key's value instead.
This isn't the best example, but you get the point. There's many situations where this would be useful (at least in my cases).
Kwargs
For when you need the user's input, you can set disableBack
to True,
which forces the user to pick one of your choices.
Last updated