Callback functions arguments

ast nomail at
Mon Oct 27 09:16:26 CET 2014


In this web site at example n°5

A program is using the "Scale" widget from tkinter module.
Here is a piece of code:

Valeur = StringVar()

echelle = Scale(Mafenetre, from_=-100, to=100, resolution=10, \
orient=HORIZONTAL, length=300, width=20, label="Offset", \
tickinterval=20, variable=Valeur, command=maj)

The "maj" callback function is:

def maj(nouvelleValeur):

When the user move the scale with the mouse, the new position
is supposed to be printed on the python shell.

The "maj" function has an argument "nouvelleValeur" but no
argument is passed through the Scale widget.

So how the hell Python knows that it has to pass parameter
"Valeur" to the "maj" function ?


More information about the Python-list mailing list