I need the item to behave like a wx.Window without being one.
What I’m trying to do is have a background image in a main frame and have the “children” being drawn in the OnPaint handler for this frame at the appropriate positions.
The children do not have rectangular shapes (round corners and such) but I want to manage them using the sizers (spacing and alignment).
I need the item to behave like a wx.Window without being one.
What I'm trying to do is have a background image in a main frame and have the "children" being drawn in the OnPaint handler for this frame at the appropriate positions.
The children do not have rectangular shapes (round corners and such) but I want to manage them using the sizers (spacing and alignment).
Any ideas?
You can put a spacer in the sizer at the position that you want it, and save a reference to the SizerItem returned by the Add. You can then use that sizer item to find the position and size of the item when drawing it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Unfortunately, your solution seams to imply bookkeeping of 2 sets of objects (the components and the sizer items).
Right now I’m thinking about avoiding this by implementing a “AddInSizer” method that will take the sizer and the arguments for the sizer and do the management of the SizerItem returned by the sizer.Add automatically.
···
On Sun, Aug 31, 2008 at 5:28 AM, Robin Dunn robin@alldunn.com wrote:
Peter Damoc wrote:
Hi list,
How do I add a custom item to a sizer?
I need the item to behave like a wx.Window without being one.
What I’m trying to do is have a background image in a main frame and have the “children” being drawn in the OnPaint handler for this frame at the appropriate positions.
The children do not have rectangular shapes (round corners and such) but I want to manage them using the sizers (spacing and alignment).
Any ideas?
You can put a spacer in the sizer at the position that you want it, and save a reference to the SizerItem returned by the Add. You can then use that sizer item to find the position and size of the item when drawing it.