[Tutor] Re: Tix Select programming problem
Guillermo Fernandez Castellanos
guillermo.fernandez.castellanos at gmail.com
Tue Dec 28 02:55:09 CET 2004
Hi,
Indeed it works. It's that kind of little details that get me crazy. I
am still not used to read the tcl Tix documentation, and sometimes I
step over otherwise evident things.
Thanks a lot,
Guille
On Wed, 22 Dec 2004 11:33:41 +0100, Michael Lange <klappnase at freenet.de> wrote:
> On Wed, 22 Dec 2004 11:37:57 +0900
> Guillermo Fernandez Castellanos <guillermo.fernandez.castellanos at gmail.com> wrote:
> Hi Guille,
> The "command" option should be assigned to the Select widget itself, not to the added buttons.
> It takes two arguments then (from the tixSelect man page):
>
> Command-Line Name:-command
> Database Name: command
> Database Class: Command
>
> Specifies the TCL command to be executed when the -value of the
> Select widget is changed. This command will be invoked with two
> arguments. The first is the name of the button subwidget that
> has toggled. The second is a boolean value indicating whether
> the button subwidget is selected. This command is executed only
> when the -disableCallback option is set to false.
>
> So I changed your code a little to make it work:
>
> import Tix
>
> def prtS(*args):
> print args
> print fruits.cget('value')
>
> def prtC(val):
> print val
> print sel.cget('value')
>
> root = Tix.Tk()
> fruits=Tix.Select(root,label="Fruits:", orientation='horizontal',command=prtS)
> fruits.add('orange',text="Orange",width=6)
> fruits.add('lemon',text="Lemon",width=6)
> fruits.add('apple',text="Apple",width=6)
> fruits.pack()
>
> sel=Tix.Control(root, label="X Coordinates", max=10, min=3,
> integer=True,command=prtC)
> sel.pack()
>
> root.mainloop()
>
> Hope this helped
>
> Michael
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list