Call function from another class
Lars
nogetfx at gmail.com
Mon Jul 27 07:48:30 EDT 2009
> If I'm not mistaken, in "doRotate" you should be able to refer to the
> to-be-closed dialog via
> self.frameRotate
>
> Now if you change the "sliderUpdate"-code to store that angle instead of
> just letting it fall out of scope, you could access that value through
> frameRotate:
>
> def sliderUpdate(self, event):
> angle=self.slider.GetValue()
> ROTATION_ANGLE=angle
> self.angle = angle
> self.Destroy()
>
> def doRotate(self,event):
> """Rotating image"""
> print self.frameRotate.angle
Thanks for replying. If Bind is used in "onRotate":
def onRotate(self,event):
"""Rotate image"""
self.frameRotate = rotationSlider(parent=None, id=-1)
self.Bind(wx.EVT_CLOSE,self.doRotate, self.frameRotate.Destroy)
self.frameRotate.Show()
Then i get:
Traceback (most recent call last):
File "viewer_sep.py", line 136, in onRotate
self.Bind(wx.EVT_CLOSE,self.doRotate, self.frameRotate.Destroy)
File "/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/
_core.py", line 3629, in Bind
id = source.GetId()
AttributeError: 'function' object has no attribute 'GetId'
My experience with ID is setting it to "-1". So I'm not sure if it is
a wrong use of Bind or an wxPython error.
/Lars
More information about the Python-list
mailing list