Accepted answer

The first positional parameter to IntVar and the other variable classes is the master that owns the variable. You are passing in the string "on" which cannot be a master.

If you want to initialize the value, pass it as a keyword argument:


This is the signature for Variable.__init__ (all tkinter variable classes inherit from this class):

class Variable:
    def __init__(self, master=None, value=None, name=None):
        """Construct a variable

        MASTER can be given as master widget.
        VALUE is an optional value (defaults to "")
        NAME is an optional Tcl name (defaults to PY_VARnum).

        If NAME matches an existing variable and VALUE is omitted
        then the existing value is retained.