473,409 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 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 4728
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
Fábio 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, I´m using Gnuplot via gnuplot.py and I´m 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.