Page 1 of 1

wxPython import deprecation

Posted: Wed Sep 02, 2009 2:49 pm
by AUser
Hi,

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

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

Posted: Thu Sep 03, 2009 3:10 am
by protocol
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.

example:
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.