On Feb 11, 2011, at 12:51 PM, Ricardo Araoz wrote:

> Is this a bug or did I misunderstand the docs?
> 
> On a side note, the method is :
>    def afterInitAll(self):
>        mb = self.MenuBar
>        fm = mb.getMenu('File')
>        fm.prependSeparator()
>        fm.prepend('back to original size', OnHit=self.fitToSizer)
> 
> It works and takes the form back to the orig. size after changes have
> been made to it's size. But in the command window the following
> exception is triggered:
> 
> Traceback (most recent call last):
>  File
> "/usr/local/lib/python2.6/dist-packages/dabo/ui/uiwx/dMenuItem.py", line
> 58, in __onWxHit
>    self.raiseEvent(dEvents.Hit, evt)
>  File
> "/usr/local/lib/python2.6/dist-packages/dabo/ui/uiwx/dPemMixin.py", line
> 1007, in raiseEvent
>    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,
> **kwargs)
>  File "/usr/local/lib/python2.6/dist-packages/dabo/lib/eventMixin.py",
> line 96, in raiseEvent
>    bindingFunction(event)
>  File
> "/usr/local/lib/python2.6/dist-packages/dabo/ui/uiwx/dPemMixin.py", line
> 815, in fitToSizer
>    self.Width += extraWidth
> TypeError: unsupported operand type(s) for +=: 'int' and 'Hit'


        fitToSizer() is a method, not an event handler. Remember, event 
handlers get passed an EventObject. In this case, the first parameter in 
fitToSizer() is 'extraWidth', which received the Hit event object.

        You need to define an event handler, such as:

def onFitToSizer(self, evt):
        self.fitToSizer()

...and set the menu to fire that.



-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to