[Tkinter-discuss] Re: Another problem -- deselecting individual entries in Tix HList

Martin Franklin mart.franklin at gmail.com
Mon Feb 28 21:28:02 CET 2005


Jared Cohen wrote:
> According to the documentation for the Tcl version of Tix, it's possible 
> to use selection_clear() to deselect individual entries, as opposed to 
> the entire selection. The documentation says the following:
> 
> 
> pathName selection clear ?from? ?to?
> 
> When no extra arguments are given, deselects all of the list entrie(s) 
> in this HList widget. When only from is given, only the list entry 
> identified by from is deselected. When both from and to are given, 
> deselects all of the list entrie(s) between between from and to, 
> inclusive, without affecting the selection state of entries outside that 
> range.
> 
> 
> However, I can't for the life of me figure out how to get this 
> functionality in Python. You'd think that you could just pass in "from" 
> and "to" as individual arguments, but you'd be wrong -- the Python 
> version of selection_clear() has the form:    selection_clear(self, 
> cnf={}, **kw) . It expects a dictionary and/or a keyword list. And I 
> can't figure out the right syntax for that "from-to" thing. Can anyone 
> help please?

Because from is a reserved word in python the Tkinter spelling of it is 
usually _from (note the leading underscore) this is true of standard 
Tkinter widgets not sure about Tix (don't use it)


For more on keyword arguments see the online docs:-

http://docs.python.org/tut/node6.html#SECTION006600000000000000000

http://docs.python.org/tut/node6.html#SECTION006720000000000000000

Cheers,
Martin.









More information about the Tkinter-discuss mailing list