Hi, I posted the following earlier under a more obscure subject and
got no reply yet. I really need some expert opinion on this.
I want to change some window attributes in the embedded wxPython part
of my code (the main code is a wxWidgets-based C++ application), but
did not succeed. I got lots of exception which all boil down to this:
all the stock colors (wx.RED, wx.BLUE,...), cursors (wx.CROSS_CURSOR)
etc. are not recognized as the proper wx objects. I did the following
test in the demo code 'embedded' to confirm that it's not a problem
unique to my code.
I basically added f.SetBackgroundColour(wx.LIGHT_GREY) to python_code1
in embedded.cpp, i.e.,
char* python_code1 = "\
import wx\n\
f = wx.Frame(None, -1, 'Hello from wxPython!', size=(250, 150))\n\
f.SetBackgroundColour(wx.LIGHT_GREY)\n\
f.Show()\n\
";
then when I click "Make wxPython frame" menu item, I got an exception TypeError:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "C:\Priithon_25_win\wx\_core.py", line 9799, in SetBackgroundColour
return _core_.Window_SetBackgroundColour(*args, **kwargs)
TypeError: Expected a wxColour object, a string containing a colour
name or '#RRGGBB', or a 3- or 4-tuple of integers.
Does anybody know why? Am I not supposed to do it this way?
When I add a 'print type(wx.LIGHT_GREY)' after 'import wx', the output
says it IS of type <class 'wx._gdi.Colour'>
I am using wx 2.8.7.1, Python 2.5, and the same problem shows up on
both Windows and Linux.
Thanks a lot!
--lin