DC drawing

Can DC drawing be done only over a frame.How can it be done on a panel which is a child of the main frame

nipun batra wrote:

Can DC drawing be done only over a frame.How can it be done on a panel which
is a child of the main frame

You can draw on a panel either by subclassing wx.Panel and handling
its EVT_PAINT event, to draw on it. Or use the main frame's EVT_PAINT,
to draw on the child Panel. But instead of using 'self' in the DC
calls (wx.BufferedDC or wx.PaintDC or whatever) use 'self.panel'.

Here are some useful links for how to do this:
http://wiki.wxpython.org/CustomisedDrawing
http://wiki.wxpython.org/DoubleBufferedDrawing

arun

Catch the panel's paint event instead of the frame's, and use the panel as the window passed to the DC's constructor.

···

On 10/3/09 3:12 AM, nipun batra wrote:

Can DC drawing be done only over a frame.How can it be done on a panel
which is a child of the main frame

--
Robin Dunn
Software Craftsman

Don't do that. On some platforms it wont matter but on others you must create a wx.PaintDC for a widget only from that widget's paint event.

···

On 10/4/09 8:03 AM, Arun Kumar wrote:

Or use the main frame's EVT_PAINT,
to draw on the child Panel.

--
Robin Dunn
Software Craftsman