(Sep-24-2018, 09:42 AM)magic Wrote: That's not default argument. I know what default argument is.This how Tkinter dos it,you should mention where code comes from to get better answers.
Those variables were never defined but passed down into the function in capital letters.
>>> from tkinter import LEFT, TOP, X, FLAT, RAISED >>> TOP 'top' >>> LEFT 'left' >>> FLAT 'flat' >>> X 'x'So
toolbar.pack(side=TOP, fill=X)
is the same as toolbar.pack(side='top', fill='x')
So it could work fine as default argument to a function.
With
toolbar.pack()
they are passed in as key word arguments(**kwargs).If look at method parameters in Tkinter code.
def pack_configure(self, cnf={}, **kw):Example:
>>> def my_function(**kw): ... print(kwargs) ... >>> my_function(a=123, b="hello") {'a': 123, 'b': 'hello'}