event binding and component.config

Greg McFarlane gregm at iname.com
Wed Aug 27 09:03:07 EDT 2003


If you want something that allows a user to select a particular mode
and then to display that mode until it is changed - use
Pmw.RadioButton instead of trying to hack Pmw.ButtonBox.  I think this
will do exactly what you want.

Greg

Scott Holmes <scottholmes at sbcglobal.net> wrote in message news:<mailman.1061059285.7748.python-list at python.org>...
> I'm experiencing what seems to be strange behaviour.  I don't know if 
> it's Pmw, Tkinter on Python.  I have a button, defined in a 
> Pmw.buttonbox, that I would like to configure to "sunken" after it has 
> been clicked/released.  Using the example style coding:
> 
>      self.buttonBox1.add('Add', command = self.addCalendar)
> 
> the button remains "sunken".  If I bind the event:
> 
>      self.buttonBox1.add('Add')
>      self.buttonBox1.component('Add').bind('<ButtonRelease-1>',
>        self.addCalendarBind)
>      self.buttonBox1.component('Add').bind('<KeyRelease-Return>',
>        self.addCalendarBind)
> 
> the button reverts to "raised".  The addCalendar and addCalendarBind are 
> still essentially stub functions:
> 
>    def addCalendarBind(self,event):
>      self.addCalendar()
> 
>    def addCalendar(self):
>      global prog_mode
>      self.clearCalendar()
>      prog_mode = 'add'
>      self.buttonBox1.component('Add').config(relief='sunken')
>      self.buttonBox1.component('Commit').config(relief='raised')
>      self.buttonBox1.component('Update').config(relief='flat')
>      self.buttonBox1.component('Delete').config(relief='flat')
>      self.buttonBox1.component('Query').config(relief='flat')
> 
> -- 
> ---------------------------------------------------------------------
> Scott Holmes                   http://sholmes.ws
>                                 http://pages.sbcglobal.net/scottholmes
>                                 scottholmes at sbcglobal.net
> 
>    Independent Programmer/Analyst                  Passport 4GL
>    PHP HTML Composer                PostgreSQL     Informix 4GL, SQL
> ---------------------------------------------------------------------
>        There are more things in heaven and earth, Horatio,
>               than are dreamt of in your philosophy
> ---------------------------------------------------------------------




More information about the Python-list mailing list