wxPython and DISLIN work nicely together

Ionel Simionescu ionel at psy.uva.nl
Tue Nov 16 17:23:28 CET 1999


Hi,


DISLIN (http://www.linmpi.mpg.de/dislin/) is a powerful visualization
package available on quite a lot of platforms, aimed at scientists.
DISLIN is "ported" to Python as well.

I want to report that wxPython and DISLIN work very well together.

Because DISLIN can paint on a window, one can easily and transparently use
it within a (X)Windows application. DISLIN can also create/convert to a
variety of formats, such as Postscript, PNG and metafiles.

Below you may find a simple illustration of the idea.
(You need both wxPython and DISLIN installed to run it.)


ionel

---

from dislin import *
from wxPython.wx import *

x = range(9)
y = x[:]

#---------------------------------------------------------------------------
class dislin_frame(wxFrame):
    def __init__(self):
        wxFrame.__init__(
            self,
            NULL, -1, "wxCML",
            wxDefaultPosition,
            wxSize(580, 400)
        )

        # paint with a double-buffering scheme
        x11mod('nostore')
        # set the DISLIN kind of paint target
        metafl('xwin')
        # set the handle of the window where DISLIN paints to us
        setxid( self.GetHandle(), 'window')
        disini()

    def OnPaint(self, event):
        plot(x,y)
        event.Skip()

#---------------------------------------------------------------------------
class myApp(wxApp):

    def OnInit(self):
        dislin_frame().Show(TRUE)
        return TRUE

#---------------------------------------------------------------------------
if __name__ == '__main__':
    app = myApp(0)
    app.MainLoop()







More information about the Python-list mailing list