Tkinter option menu Tkinter option menu tkinter tkinter

Tkinter option menu


You could use the *-operator to unpack an argument list like so:

...options = ['one', 'two', 'three', 'four']option = OptionMenu(master, var, *options)option.pack()...

More information about unpacking arguments can be found here: http://docs.python.org/2/tutorial/controlflow.html#unpacking-argument-lists

You should note that the *-operator can also be used to accept an arbitrary number of arguments, for example:

def print_names(*names):    for name in names:        print(name)print_names('Bob', 'James', 'Harry')

Which would output:

BobJamesHarry

There also exists the **-operator which works in a very similar way, except that it uses keyword arguments. If you wish to learn more about these operators and their usages, then I highly recommend visiting the documentation article that I linked above (relevant information begins here: http://docs.python.org/2/tutorial/controlflow.html#keyword-arguments).