event binding and component.config

Discussion in 'Python' started by Scott Holmes, Aug 16, 2003.

  1. Scott Holmes

    Scott Holmes Guest

    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


    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
    ---------------------------------------------------------------------
    Scott Holmes, Aug 16, 2003
    #1
    1. Advertising

  2. 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 <> wrote in message news:<>...
    > 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
    >
    >
    > 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
    > ---------------------------------------------------------------------
    Greg McFarlane, Aug 27, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karuppasamy

    com+ component and Component Service

    Karuppasamy, Jan 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    605
    Karuppasamy
    Jan 13, 2004
  2. Karuppasamy

    com+ component and Component Service

    Karuppasamy, Jan 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,523
  3. CSharpner
    Replies:
    0
    Views:
    1,022
    CSharpner
    Apr 9, 2007
  4. Bill Anderson

    Custom Component and Custom Textbox binding

    Bill Anderson, Dec 10, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    481
    Bill Anderson
    Dec 15, 2003
  5. Miguel Minora
    Replies:
    1
    Views:
    150
    Miguel Minora
    Jan 11, 2005
Loading...

Share This Page