AttributeError: ‘module’ object has no attribute ‘CONTROL_EXPANDED’
Traceback (most recent call last):
File “D:\Tree\CustomTreeCtrl.py”, line 4494, in OnPaint
self.PaintLevel(self._anchor, dc, 0, y)
File “D:\Tree\CustomTreeCtrl.py”, line 4429, in PaintLevel
flag |= wx.CONTROL_EXPANDED
AttributeError: ‘module’ object has no attribute ‘CONTROL_EXPANDED’
the wx.RendererNative class has been added in wxPython 2.6.2.1, so there is no way to make CustomTreeCtrl running on older version of wxPython other than modify the source code to draw the tree control buttons by hand… at the moment I haven’t implemented it yet, but I am sure that if you switch to 2.6.3.2 you won’t have any problem in running this control.
So when I bind to EVT_TREE_SEL_CHANGING, I can test for the modifiers. If there aren't any, I know that the user is just clicking on another item, and I can let them do that. BUt if they have a modifier down, they are either adding or subtracting to the current selection, and then I can test and see if the addition is allowed or not, depending on my applications logic.
You aren't going to get a key event unless the tree event was initiated by a keystroke. Mouse events and higher-level tree events will not have a key event to give you. You can use wx.GetMouseState instead, and it will poll the current state of the modifier keys (as well as the mouse position and buttons.)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Maybe the bug really should be that wx.GetMouseState needs to be renamed wx.GetMouseAndKeyboardState for those of us who haven't read the entire API.
···
On May 23, 2006, at 4:51 PM, Robin Dunn wrote:
Andrea Gavana wrote:
Hello Robin & John,
You aren't going to get a key event unless the tree event was initiated
by a keystroke. Mouse events and higher-level tree events will not have
a key event to give you. You can use wx.GetMouseState instead, and it
will poll the current state of the modifier keys (as well as the mouse
position and buttons.)
It seems to me that this issue is growing as confused, at least for
me... I can't get a KeyEvent, Ok. Should I check for wx.GetMouseState
inside the OnKeyEvent of CustomTreeCtrl? What is the OnKeyEvent method
supposed to give back as a return value?
No, you're doing it correctly. My response was for John who seems to be expecting that event.GetKeyEvent() should return a non-None value for events besides EVT_TREE_KEY_DOWN. I was just explaining that there won't be a KeyEvent value for the other events because there can't be one (since the tree only gets one from wx for the EVT_KEY_DOWN event and not for any of the others.)
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org