My wxPython 2.7.x Upgrade From 2.6.x
I’m not sure exactly why I did it. I decided to install wxPython 2.7.x on my WinXP development environment. Several things to note about the changes:
- py2exe will start throwing errors (although the latest and greatest is supposed to fix it) about gdiplus.dll not being found. The solution is to use the
--dll-exclude gdiplus.dlloption to prevent getting the error message. This also means that you need to make sure that the Win2K machines that you deploy to already have the Win2K gdiplus.dll already installed or that you distribute an appropriate version with your code. I’m still needing to test this out. - I had a text control (a search field) for which I was looking for the ENTER key (via Bind on wx.EVT_KeyUp) so that I could launch an action immediately when the user pressed enter (after filling the search field). In wxPython 2.7, the behavior (at least in windows) is to now advance to the next field (like a TAB key was pressed) on using the ENTER key in a single line text control. The solution is fairly simple: just include
style=wx.TE_PROCESS_ENTERin your init parameters for the text control and the control can start getting the ENTER keys again. - I also had registered the ESCAPE key as a hot key for a button (a cancel button) on a form. In 2.6.x, it worked fine. In 2.7.x, the escape key seems to be unavailable as a hot key for a control. Instead, I registered a handler for a CHAR_HOOK event for the whole form and look for the escape there. This has the disadvantage that you sometimes can get several events for the same key press. But at least you can get it. The code in the __init for the form looks something like this:
self.Bind(wx.EVT_CHAR_HOOK,self._onKey)
Then later on, we define self._onKey something like this:
def _onKey(self,evt): if evt.GetKeyCode() in [wx.WXK_ESCAPE]: self.handler.handleCancelButton(evt) else: evt.Skip()
- I am now having an issue with a StaticBoxSizer not properly expanding to fill its space. I am still researching this issue but it clearly is related to the upgrade since it was working correctly before.
Technorati Tags: python, wxpython, py2exe
No comments yet. Be the first.
Leave a reply