tkinter/commands help
Arun Ramanathan
aramanat at optonline.net
Wed Jul 4 13:17:27 EDT 2001
I am trying to run a rsh command from the commands module.
My code for a tkinter button and call back looks like this.
from Tkinter import *
import commands
def callme():
result = commands.getoutput('rsh -l username hostname showrev -p')
mytext.delete(0.0,END)
mytext.insert(0.0,result)
root = Tk()
...
...
b1 = button(root,text ='patchlist',command=callme)
b1.pack(side=LEFT,fill=X)
text = Text(root,width='40',height='25')
text.pack(side=BOTTOM,fill=X)
....
..
root.mainloop()
when I hit the button from the gui, for about 80% of the time I do get
an
output displayed in the Text widget. for 20% of the time the GUI just
stalls/stops and hangs. the gui stops responding to anything else.
I had to kill the application.
Is there a reason why this is happening. I even tried using the thread
module
and calling the callback with a new thread, I got the same results. I
tried printing
out the output from the following line
result = commands.getoutput('rsh -l username hostname showrev -p')
print result
I found that during the 20% times the gui hangs the result is some kind
of a
number like 123456.123456.
Can someone help me understand why this happens.
Arun
More information about the Python-list
mailing list