wxPython import deprecation

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

wxPython import deprecation

Post by AUser » Wed Sep 02, 2009 2:49 pm


I am currently trying to make a small wxPython application from sourceforge work (openraytrace, not updated for many a year). I'm not super-familiar with python, but I have used it in the past. I have used wx under c++, which seems to work well.

Anyway, I noted from the python documentation :

Code: Select all

from wxPython.wx import *
is suggested in all the examples, however using this causes the app to fail in wxDateTime_GetNumberOfDaysinYear, with the following warning at the top:
openraytrace/myGLCanvas.py:39: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible.
from wxPython.wx import *
I note at http://wiki.wxpython.org/wxPython%20Style%20Guide#, the import useage above is described as ancient, and current wxPython useage should simply "import wx". Are the current wxPython docs just really out of date, or do I not understand something fundamental?

I ask as I am having trouble locating where objects have moved to in the current wxPython/pywx/whatever object tree. For example, I need to convert self.Bind(wx.EVT_GRID_CELL_CHANGE,self.ongridblahblah) type satements to the correct statement, however I have no idea how to read the appropriate documentation to find *where* this constant might be.

Thanks in advance

I'm running debian squeeze on i686, if it matters.

Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX

Post by protocol » Thu Sep 03, 2009 3:10 am

Correct use "import wx".

The convention for wxPython is: use wx.* to access the Python equivalent.

In short, all C++ documentation is almost exactly the same for wxPython.

C++ = EVT_BUTTON, wxMessageBox
Py = wx.EVT_BUTTON, wx.MessageBox

wx is the namespace/prefix to access all of wxWidgets.

The included wxPython examples will be one of the best teachers.

best regards.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
wxPCRE & ObjPCRE - Regex It!

Post Reply