wx.EVT_PAINT and refreshing a DISLIN plot

I'm new to Python, so bear with me.....

I'm calling the DISLIN plotting package from python to plot in a
wxPython panel. This works OK but the plot gets grayed out when
another window is moved over it. There is a DISLIN function, sendbf,
which updates the graphics window with a pixmap, so I thought I could
use wx.EVT_PAINT to invoke this.

So I made a subclass as follows

class refreshablePanel(wx.Panel):

    def __init__(self, parent, id, pos, size):
        wx.Panel.__init__(self, parent, id, pos, size)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

    def OnPaint(self,event):
        sendbf

and replaced following line in my frame class

    plotpanel = wx.Panel(self, -1,pos=(0,30),size=(1000,700))

with

    plotpanel = refreshablePanel(self, -1,pos=(0,30),size=(1000,700))

But the program just hangs when it comes to plot anything. I'd be very
grateful for help with this....

I'm new to Python, so bear with me.....

I'm calling the DISLIN plotting package from python to plot in a
wxPython panel. This works OK but the plot gets grayed out when
another window is moved over it. There is a DISLIN function, sendbf,
which updates the graphics window with a pixmap, so I thought I could
use wx.EVT_PAINT to invoke this.

So I made a subclass as follows

class refreshablePanel(wx.Panel):

     def __init__(self, parent, id, pos, size):
         wx.Panel.__init__(self, parent, id, pos, size)
         self.Bind(wx.EVT_PAINT, self.OnPaint)

     def OnPaint(self,event):
         sendbf

If sendbf is a function then you need to call it, not just evaluate it. Also, if you are running on Windows then EVT_PAINT handlers *must* create a wx.PaintDC, even if it will not be used. Otherwise the system will assume that the event was not processed and will immediately send another paint event, starving out almost everything else in the application...

But the program just hangs when it comes to plot anything. I'd be very
grateful for help with this....

...which sounds like what is happening in your case.

···

On 10/28/10 4:08 AM, sinjun wrote:

--
Robin Dunn
Software Craftsman