Version 4 of My question is listed here--Please help!!!

Updated 2009-07-07 18:55:45 by LV

Hello,

I am trying to make a tcl/tk GUI front end for a python script which returns a figure. I am trying to display the figure in a frame and try as I might I cannot get this to work. I have tried reading the image/photo stuff and also tried to embed picture viewer into the frame with no avail. I can also (if absolutely need be) have the python script save the image to a temp file so tk can display it (would most likely be a png if we went that route). Please help! This has been an on going issue for me. Thank you!


Well, I have no idea about your specific application. However, it seems, to me, that a good place to start would be to write a basic Tcl/Tk program that reads a static image file and displays it. Once you have that program written, then at the very least you could have your python program write out a static image file and display it from your tcl/tk program.

To move along farther, you have to then make some decision on how to get the image data from the python program to the tcl/tk program in a fashion that could be displayed. A number of techniques for exchanging data between two processes are mentioned at inventory of ipc methods.


A simple example of what Larry mentioned above would be:

  1. Download and install ActiveTcl (or build Tcl, Tk, and Img on your own).
  2. Save the following lines to the file show_img.tcl.
package require Img
set myimage [image create photo -file mypngimg.png]
label .l1 -image $myimage
pack .l1
  1. Run it from a shell prompt with
wish show_img.tcl

(or wish8.5.exe, depending on your platform).