[issue36171] tkinter scrollbar missing 'state' option

Cheryl Sabella report at bugs.python.org
Sun Mar 3 19:01:34 EST 2019


Cheryl Sabella <cheryl.sabella at gmail.com> added the comment:

That's because state isn't an option.  :-)

I should have included the link to the ttk scrollbar manpage.
https://www.tcl.tk/man/tcl/TkCmd/ttk_scrollbar.htm

You'll see on that page that 'state' is listed as a Widget Command and not an Option:
    STANDARD OPTIONS

        -class, undefined, undefined 
        -cursor, cursor, Cursor 
        -style, style, Style 
        -takefocus, takeFocus, TakeFocus 

    WIDGET-SPECIFIC OPTIONS

        -command, command, Command 
        -orient, orient, Orient 

    WIDGET COMMAND

        pathName cget option 
        pathName configure ?option? ?value option value ...? 
        pathName get 
        pathName identify x y 
        pathName instate statespec ?script? 
        pathName set first last 
        pathName state ?stateSpec? 

    INTERNAL COMMANDS

        pathName delta deltaX deltaY 
        pathName fraction x y 

    SCROLLING COMMANDS

        prefix moveto fraction 
        prefix scroll number units 
        prefix scroll number pages 

If you notice, your listing of the options includes the 6 options listed above: command, orient, takefocus, cursor, style, class.  It doesn't list any of the other widget commands, such as cget or configure.  state is like those and not like the options.

In other words, you would use `w.state(['!disabled', 'selected'])` as shown in the example on the New Mexico Tech link.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36171>
_______________________________________


More information about the Python-bugs-list mailing list