event binding and component.config

S

Scott Holmes

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
(e-mail address removed)

Independent Programmer/Analyst Passport 4GL
PHP HTML Composer PostgreSQL Informix 4GL, SQL
 
G

Greg McFarlane

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top