dislin interfaced with tkinter

Tom B. sbabbitt at commspeed.net
Tue Aug 3 21:19:34 CEST 2004


"eesun" <eesun at free.fr> wrote in message
news:34c9b4fa.0408030743.594417f9 at posting.google.com...
> Hi,
>
> I've downloaded the dislin package for the scientific plotting. And I
> have already created the application window with Tkinter (menu,
> canvas, status bar..). I want to integrate the Dislin plotting into
> the Tkinter application. For ex: show the dislin result on the Tkinter
> Canvas. Anyone can help?
>
> thx

I haven't worked with Dislin/Tkinter but I have worked with Dislin/wxPython
and what you can do is dump the Dislin output into a string buffer.

A shade plot,

def dis_img(self,zmat,m, n, zlo, zhi):
    char = ''
    max_bytes = 0
    xray = range (n)
    yray = range (m)
    dislin.metafl ('VIRT')
    dislin.setpag ('da4l')
    #dislin.setfil (self.globdir)
    dislin.disini ()
    dislin.pagera ()
    dislin.hwfont ()
    dislin.ax3len (1400, 1400,1400)
    dislin.autres(n, m)
    dislin.shdmod ('poly', 'contur')
    dislin.graf3   (0, n, 0, n/5, 0, m, 0, m/5, zlo, zhi, zlo, (zhi-zlo)/5)
    dislin.crvmat (zmat, n, m, 1, 1)
    dislin.title  ()
    char_buff = dislin.rbfpng(max_bytes)
    max_bytes = int(char_buff[1])
    char_buff = dislin.rbfpng(max_bytes)
    char =  char_buff[0]
    #char now contains a PNG image of the output. I use Python Imaging
Library
    #and open like this
    self.Imagetest = Image.open(StringIO.StringIO(char))
    dislin.disfin ()

Tom





More information about the Python-list mailing list