On Wed, 22 Dec 2004 11:37:57 +0900 Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote:
Hi Guille, > > I'm playing now with the Select buttons: > > import Tix > > def prtS(): > print fruits.cget('value') > > def prtC(val): > print val > print sel.cget('value') > > root = Tix.Tk() > fruits=Tix.Select(root,label="Fruits:", orientation='horizontal') > fruits.add('orange',text="Orange",width=6,command=prtS) > fruits.add('lemon',text="Lemon",width=6,command=prtS) > fruits.add('apple',text="Apple",width=6,command=prtS) > fruits.pack() > > sel=Tix.Control(root, label="X Coordinates", max=10, min=3, > integer=True,command=prtC) > sel.pack() > > root.mainloop() > 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 - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor