[Tkinter-discuss] embedding in Tkinter

Cameron Laird Cameron at phaseit.net
Wed Sep 7 02:44:20 CEST 2011


On Wed, Sep 07, 2011 at 09:44:21AM +1000, John McMonagle wrote:
> On 06/09/11 22:24, Alessandro Magni wrote:
> > Hi everybody,
> > I hope somebody here can give me a hand - I'm not so expert in GUI programming.
> > I tried - in a Tkinter program I'm writing - to embed a terminal
> > (linux here) in the main window - the program is a simple wiki, and I
> > believe it's useful to have a small terminal handy...
> > Optionally, I would like also to be able to let my program interact
> > with the terminal - at a minimum I'd like to read the current working
> > directory, and to set it.
			.
			.
			.
> I've modified your little example above with some success:
> 
> from Tkinter import *
> import os
> 
> root = Tk()
> termf = Frame(root, height=200, width=400)
> termf.pack(fill=BOTH, expand=YES)
> wid = termf.winfo_id()
> os.system('xterm -into %d -geometry 400x200 -e /root/.bashrc&' % wid)
> 
> root.mainloop()
			.
			.
			.
Alessandro, when you write "Optionally, I would like also to be
able to let my program interact with the terminal - at a minimum
I'd like to read the current working directory, and to set it"
and "... it doesn't work", I am unsure of your meaning.  John
answered what I understand of your question about Tkinter coding
well; do you also want help communicating between the xterm's
$SHELL and the Python application, or do you have what you need
for that aspect, already?


More information about the Tkinter-discuss mailing list