wx.Controls without parents
Frank Tobia
frank.tobia at gmail.com
Thu Jul 19 09:24:06 PDT 2007
Hi all,
I've run into a cross-platform inconsistency involving Controls and their
need for parents. I want to clarify that this behavior is expected, so I
can update the unit test suite accordingly.
Running the following at an interactive prompt:
import wx
app =3D wx.PySimpleApp()
b =3D wx.Button(None)
does different things depending on your platform. Apparently, wxGtk will
instantiate a parentless Button with no problems. On Windows, we get
>>> b =3D wx.Button(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_controls.py",
line
86, in __init__
_controls_.Button_swiginit(self,_controls_.new_Button(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "parent" failed at
..\..\src\common\ctr
lcmn.cpp(79) in wxControlBase::CreateControl(): all controls must have
parents
and the same type of thing on Mac (see the results at the bottom of
http://wiki.wxpython.org/Test_Suite_Results?action=3Dshow).
Example:
testAllControlsNeedParents (testRadioBox.RadioBoxTest)
Traceback (most recent call last):
File "/Users/cody/Desktop/Python/wx_stuff/unittest/unittest/testControl.p=
y",
line 31, in testAllControlsNeedParents
class_under_test(None)
File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/si=
te-packages/wx-2.8-mac-unicode/wx/_controls.py",
line 2356, in __init__
_controls_.RadioBox_swiginit(self,_controls_.new_RadioBox(*args, **kwar=
gs))
PyAssertionError: C++ assertion "parent" failed at
/BUILD/wxPython-src-2.8.4.0/src/mac/carbon/window.cpp(1090) in
Create(): can't create wxWindowMac without parent
Additionally, trying to instantiate other wx.Windows without parents will
also fail on Windows and Mac but not Gtk. Can anyone clarify what causes
these discrepancies, and whether or not they are the correct behavior?
Thanks.
-Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-dev/attachments/20070719=
/e12e3a6e/attachment.htm
More information about the wxpython-dev
mailing list