472,954 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

tkinter gnuplot

Hi, I use both python and gnuplot a lot, but I am
unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT option in
PMW is not so powerful and not so great, any suggestions ??

thanks
ram
Jul 18 '05 #1
4 4656
Fernando Perez wrote:
Rama Calaga wrote:
Hi, I use both python and gnuplot a lot, but I am
unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT
option in PMW is not so powerful and not so great, any suggestions ??


I don't think there's an easy way to do that, since all access to gnuplot
from
python is via a pipe. Gnuplot is an external program, not a library. You
might be able to make gnunplot generate .pngs and then load those into a tk
canvas, but it will be clumsy.


Mmh, Gnuplot does have a tkcanvas terminal:

This terminal driver generates Tk canvas widget commands based on Tcl/Tk
(default) or Perl. To use it, rebuild `gnuplot` (after uncommenting or
inserting the appropriate line in "term.h"), then

gnuplot> set term tkcanvas {perltk} {interactive}
gnuplot> set output 'plot.file'

After invoking "wish", execute the following sequence of Tcl/Tk commands:

% source plot.file
% canvas .c
% pack .c
% gnuplot .c

[...] See the gnuplot help for more.
So you might be able to rebuild gnuplot with this terminal, and then figure out
how to make the generated tcl/tk code accessible to tkinter. I'm not a
tkinter expert, so I have no idea how this would work.

Still, matplotlib is ready for this out of the box, so it might be less work.

Best,

f
Jul 18 '05 #2
Rama Calaga wrote:
Hi, I use both python and gnuplot a lot, but I am
unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT
option in PMW is not so powerful and not so great, any suggestions ??


I don't think there's an easy way to do that, since all access to gnuplot from
python is via a pipe. Gnuplot is an external program, not a library. You
might be able to make gnunplot generate .pngs and then load those into a tk
canvas, but it will be clumsy.

You might want to look at http://matplotlib.sourceforge.net. It's a true
python plotting library (as opposed to a pipe to an external program), set up
from the get-go for GUI embedding (with Tk, GTK and WX examples included).

Best,

f
Jul 18 '05 #3
Em Qua, 2004-11-10 s 15:31 -0700, Fernando Perez escreveu:
Rama Calaga wrote:
Hi, I use both python and gnuplot a lot, but I am
unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT
option in PMW is not so powerful and not so great, any suggestions ??


I don't think there's an easy way to do that, since all access to gnuplotfrom
python is via a pipe. Gnuplot is an external program, not a library. You
might be able to make gnunplot generate .pngs and then load those into a tk
canvas, but it will be clumsy.

You might want to look at http://matplotlib.sourceforge.net. It's a true
python plotting library (as opposed to a pipe to an external program), set up
from the get-go for GUI embedding (with Tk, GTK and WX examples included)..

Best,

Or even scipy. It's a great scientific library and I think it uses
gnuplot as one of the graphical frontends (http://scipy.org) . I'm not
sure if it allows you to pass arbitrary gnuplot commands, but if you
want to build such a thing, surely the source could be helpful.

Cheers,
Fabio
Jul 18 '05 #4
Fbio Mendes wrote:
Or even scipy. It's a great scientific library and I think it uses
gnuplot as one of the graphical frontends (http://scipy.org) . I'm not
sure if it allows you to pass arbitrary gnuplot commands, but if you
want to build such a thing, surely the source could be helpful.


The gnuplot support in scipy is more or less deprecated, as scipy has a new
framework (Chaco) coming down the pipe, and much of today's scipy user base is
moving over to matplotlib.

For the diehard gnuplot users (a group I happen to still belong to), Gnuplot.py
offers a pretty clean interface. IPython (http://ipython.scipy.org) adds a
fair amount of functionality to make interactive gnuplot work much more
efficient, as well as simplifying some common tasks with a better syntax.

But again, the problem is that gnuplot was not meant to be embedded as a Tk
widget, which was the OP's intent. The tkcanvas terminal type is an intriguing
option, but I have no idea how hard (if it's even possible) it would be to use
that in a Python/Tkinter application.

Best,

f

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: rhmd | last post by:
I need to create image files (eg bmp or jpeg) of xy scatter graphs (i.e., graphs in which markers denote individual points; the markers need to be small polygons of various sizes, shapes, colors,...
6
by: Richard | last post by:
I am going to need to plot some data and formula results from Python. A few years ago I used gnuplot (not from Python) and was wondering which Python plotting module I should use (learn)? I...
3
by: Blues | last post by:
Hey, I have used two great models - Tkinter and Gnuplot.py - for a while. I can display an image on a Canvas widget using Tkinter and I can also generate a gnuplot from Python on the fly in a...
9
by: syd | last post by:
I don't even know where to begin. This is just bizarre. I just picked up the Gnuplot.py module (a light interface to gnuplot commands) and was messing around with it today. I've got a tiny...
6
by: Joseph Suprenant | last post by:
Hello all, I have a C++ program, it does some calculations on things and then prints out a file in the format in which GNUPLOT can use. So my question is how would i call GNUPLOT from my C++...
2
by: Titi Anggono | last post by:
Hi all, I have some questions: 1. Can we use Tkinter for web application such as Java ? 2. I use gnuplot.py module for interfacing with gnuplot in linux. Can we make the plot result shown in...
1
by: Nicola Kaiser | last post by:
Hi, Im using Gnuplot via gnuplot.py and Im looking for a way to get the plotting output (terminal set to png in my case) piped in a string instead of to stdout or a file. Is there any...
0
by: bwaha | last post by:
I've posted this question to comp.graphics.apps.gnuplot too but given that this python group may also comprise a lot of gnuplot users, and is far more active, I've posted this question here too. My...
0
by: Titi Anggono | last post by:
Hi all, I made 2 arrays, which are i and uzuy (both are float). And I want to plot the graph between those arrays. I followed from the manual ==================
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.