event binding and component.config

Scott Holmes scottholmes at sbcglobal.net
Sat Aug 16 20:40:05 CEST 2003


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