Scale does not accept the event. It takes the current value. Try the following:
def cmd(value): print int(value)
If you read the Tk tutorial , he explains this:
There is a "command" configuration option that allows you to specify a script to invoke whenever the scale changes. Tk automatically adds the current scale value as a parameter each time this script is called (we saw a similar thing with the addition of additional parameters to scroll callbacks and scroll scrolls).
Or, if you read the actual manpage :
Specifies the prefix of the Tcl command to invoke whenever the zoom value is changed using the widget command. The actual command consists of this option followed by a space and a real number indicating the new scale value.
In other words, the way to distinguish them is to read documents. Unfortunately, Tkinter docs are not all that much - they assume that you already know how Tcl / Tk works, or how to search for it yourself. This is why documents begin with a list of links to Tk documentation sources.
If you prefer to find out by trial and error, itβs not so difficult to understand what happened:
def cmd(*args): print('Scale command says {}'.format(args)) def enable(*args): print('Button command says {}'.format(args))
But this will not always tell you everything you need to know; there are other callbacks whose arguments are not obvious enough to be found without a lot of work or that can be configured (for example, check the callback).
source share