Using Tk code directly from Tkinter

Cameron Laird claird at starbase.neosoft.com
Tue Aug 27 19:51:21 CEST 2002


In article <946D85627FA3D219.9145EC7E48D59742.D0234BA543F6A756 at lp.airnews.net>,
I told a falsehood:
>In article <3d6b496a at news01.datazug.ch>,
>Volker Dobler <volker.dobler at vivastar.com> wrote:
>>Hello,
>>
>>I'd like to use Tk code directly in Tkinter:
>>gnuplot can produce plot output as Tk commands stored
>>in a file 'plot.tk'. Basically a procedure gnuplot is defined
>>which needs a canvas widget. Calling this procedure will
>>draw the plot in the given canvas.  Is it possible to feed
>>such a file into Tk via Tkinter or would it be easier to
>>write a new terminal for gnuplot which outputs Tkinter
>>code to be execed in Python?
>>
>>Volker
>>
>>
>>
>
>Yes, it is possible to ask Tkinter to interpret Tcl
>source.
>
>There are a couple of ways to go about this.  Does
>  import Tkinter
>  Tkinter.tk.eval("source myscript.tcl")
>give you the start you want? 
			.
			.
			.
Answer:  of course not, because it's utterly wrong.
  Tkinter.Tk().tk.eval("source plot.tk")
is far closer.  I sent out the wrong draft; I apologize
to those who trusted my previous message.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list