From: Phil E. <ph...@li...> - 2002-11-16 01:05:31
|
My setup: I happened to be running the resource editor from a command prompt tonight, and noticed that the exception shown below gets thrown when I try to drag a Button widget to a new location. Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/PythonCardPrototype/components/button.py", line 131, in _dispatch if binding.wxPython_EventBinding._dispatch(self, aWxEvent): File "/usr/lib/python2.2/site-packages/PythonCardPrototype/binding.py", line 205, in _dispatch self._component.notifyEventListeners( evt ) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/event.py", line 334, in notifyEventListeners listener.eventOccurred( event ) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/dispatch.py", line 81, in eventOccurred handler.getFunction()(self._scriptable, nativeEvent) File "/home/phile/pycard/tools/resourceEditor/resourceEditor.py", line 323, in on_mouseDrag if event.target.name not in self.sizingHandleNames and self.components.has_key(self.startName): AttributeError: Panel instance has no attribute 'name' Although I've had a look at the code, I haven't been playing around with PyCard for long enough to truly understand what it's doing. It looks to my untrained eye as though the Panel is receiving the mouse drag event instead of the button... A quick run down the components menu reveals that the same exception is also thrown when trying to drag CheckBox, Choice, Gauge, Image, ImageButton, List, RadioGroup, StaticBox and StaticLine widgets. All other components can be dragged normally. At the point where the exception occurs, event.__dict__ contains this: {'y': 4, 'target': <C wxPanel instance at _86602c8_wxPanel_p>, 'x': 47, 'this': '_bfffeb30_wxMouseEvent_p', 'position': (47, 4), 'altDown': 0, 'thisown': 0, 'controlDown': 0, 'eventObject': <C wxPanel instance at _86602c8_wxPanel_p>, 'shiftDown': 0} And event.target.__dict__ looks like this: {'_imageFile': '', 'this': '_86602c8_wxPanel_p', 'thisown': 1, '_frame': <C wxFrame instance at _865f4d0_wxFrame_p>, '_bitmap': None, '_backgroundTiling': 0} Sure enough, there's no 'name' attribute in there. I'm using Mandrake Linux 8.2, Python-2.2, wxPython-2.3.3 and PythonCard-0.6.9. I've also found that I can position these components manually by simply keying the co-ordinates into the 'position' field in the properties list. -- Regards Phil Edwards Brighton, UK |