By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,199 Members | 952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,199 IT Pros & Developers. It's quick & easy.

dislin interfaced with tkinter

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
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.