467,926 Members | 1,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

dislin interfaced with tkinter

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
Jul 18 '05 #1
  • viewed: 1784
Share:
5 Replies
eesun wrote:
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?


I believe that dislin plots trough its own graphical device
that is independent of Tkinter thus cannot be integrated
with it.

You might want to try matplotlib, it has Tk backend

http://matplotlib.sourceforge.net/

the nice folks there might be able to help you out.

Istvan.

Jul 18 '05 #2
On 3 Aug 2004, eesun wrote:
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?


I don't know anything about dislin; scanning through its web site, it
looks like a commercial C program. The only two ways I can think of to
integrate something like this into a Tkinter (or any toolkit) application
are:

1) If there's a way to pass dislin a window ID in which to draw (it
doesn't look like it; its openwin() function uses internal IDs), you can
create a Frame widget and pass the value returned by its .winfo_id()
method to the library.

2) If you can find no better way, as a last resort you can have dislin
write its output to an image file, and read the file using the Python
Imaging Library (PIL), which is integrated very well into Tkinter (you can
use its ImageTk class to create an image suitable for a Label, Canvas, or
what-have-you).

If your application isn't dependant on dislin and doesn't need 3D
graphing capabilities, consider switching to matplotlib
(http://matplotlib.sf.net/), which provieds the embedability you want.

Jul 18 '05 #3

"eesun" <ee***@free.fr> wrote in message
news:34**************************@posting.google.c om...
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
Jul 18 '05 #4
On Tue, 3 Aug 2004, Tom B. wrote:
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.

[code]


Building on that, the only change needed to use that with Tkinter would be
to convert the Image object into a PhotoImage object using
ImageTk.PhotoImage:

self.Imagetest = ImageTk.PhotoImage(Image.open(StringIO.StringIO(ch ar)))

Jul 18 '05 #5
eesun wrote:
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?


There is a package called disipyl which provides a more object oriented
interface to dislin. It includes interfaces to wxPython and Tkinter. It
hasn't been updated in a couple of years, but dislin hasn't changed much in
that time either.

http://kim.bio.upenn.edu/~pmagwene/disipyl.html
Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gaubitzer Erwin | last post: by
1 post views Thread by Karin Lagesen | last post: by
2 posts views Thread by Tom Richardson | last post: by
6 posts views Thread by Richard | last post: by
3 posts views Thread by luis | last post: by
1 post views Thread by adolfo | last post: by
3 posts views Thread by adolfo | last post: by
reply views Thread by Helmut Michels | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.