Hello NG,
In porting the code from C++ to Python, I'm facing a difficulty. It
is not easy to explain, so pardon me if I am a little bit confusing.
Basically, I have a class called FoldWindowItem. In C++, the __init__ function
of this class accepts a generic wxWindow OR a separator (a simple wxWindow
with black/custom colour). In C++, considering the generic wxWindow case,
you can call this class in this way:
wxFoldWindowItem(wxWindow *wnd, int flags = wxFPB_ALIGN_WIDTH, int ySpacing
= wxFPB_DEFAULT_YSPACING,
int leftSpacing = wxFPB_DEFAULT_LEFTSPACING, int rightSpacing
= wxFPB_DEFAULT_RIGHTSPACING)
: _wnd(wnd)
, _type(WINDOW)
, _flags(flags)
, _leftSpacing(leftSpacing)
, _rightSpacing(rightSpacing)
, _ySpacing(ySpacing)
, _lineWidth(0)
, _lineY(0)
{
The generic wxWindow can be whatever you want (a button, a sizer, a listctrl,
and so on). The problem is that, in Python, I have to initialize it in some
way (I don't know if I can initialize it in a generic way). At the moment
I do the following:
class FoldWindowItem(wx.Window):
In this way, however, I can only initialize the class as a wxWindow, and
not as a button, listctrl, and so on.
To be clearer (I hope), the C++ class acts like the sizer behavior (in my
opinion). You can add whatever you want to a sizer (and this "whatever"
is a generic wxWindow, transformed in C++ to the object you want, like a
button, a listctrl and so on). In Python, I don't know how to handle this
situation.
Could anyone please enlight me? Sorry, probably is a stupid question, but
I was not able to find any solution...
Thank you a lot.
Andrea.