Menu

#81 add handlers after initialization

closed
nobody
None
5
2001-09-07
2001-09-06
Kevin Altis
No

see _parseHandlers and _addHandler in model.py
should be able to wrap up:

import new
bg.on_btn1_mouseClick = new.instancemethod
(on_btn1_mouseClick, bg, bg.__class__)

So that it does all the necessary Handler calls and
updates the bg._handlers dictionary

Discussion

  • Kevin Altis

    Kevin Altis - 2001-09-06

    Logged In: YES
    user_id=228025

    >>> bg = pcapp.getCurrentBackground()
    >>> comp = bg.components
    >>> def on_btn1_mouseClick(self, button, event):
    ... print "hello"
    ...
    >>> comp['btn1'] =
    {'type':'Button', 'name':'btn1', 'position':(0,
    30), 'label':'btn1 hello'}
    >>> import new
    >>> bg.on_btn1_mouseClick = new.instancemethod
    (on_btn1_mouseClick, bg, bg.__class__)

    could also define the event binding before creating the
    widget, but it doesn't seem to matter

     
  • Kevin Altis

    Kevin Altis - 2001-09-07
    • status: open --> closed
     

Log in to post a comment.