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?
John, Cameron, thank you so much for your help... I feel a bit stupid, what was happening was a problem in the launch of xterm (I mistakenly wrote an option), Tkinter works flawlessly... Anyway I'm glad we talked about it since the general mood on stackoverflow was - as I said - that a) it was a very complex problem and b) you could not hope to solve it with such a joke as Tkinter. Serve them right! I answered them with your help, let's see if they can do it in so few lines with pyGTK :-) Anyway I'm still working on the interaction between the program and the terminal: I dont know if it can be done internally by python, but I found this program http://www.thrysoee.dk/xtermcontrol/ that could help, I'm working on it... thank you again alessandro
participants (1)
-
Alessandro Magni