Oddities of Tkinter

James Stroud jstroud at ucla.edu
Mon Jan 23 14:46:21 EST 2006


Tuvas wrote:
> I am building a tkinter program. A part of this program is to read data
> from an incoming interface, and depending on the data, will display a
> bit of text on the tk dialog, it decodes this data, so to speak. If one
> command is sent, everything's just fine. When multiple are sent, the
> program will stop responding, and will only continue to respond after
> one types <ctrl>-c. The statement at fault is something like this.
> 
> e1=StringVar()
> Label (master,textvariable=e1, width=32).grid(row=44, column=4)
> 
> def disp_mes1(text):
>   e1.set(text)
> 
> It's the line 31.set(text) that takes so long when there's other
> processes running. I've ran this program sucessfully many times on
> another computer, however, when transfering to another with the same
> OS, this problem was created. Any ideas as to what I might be able to
> do to fix this problem? My main code is hopelessly complex to post the
> entire thing, and I can't recreated the same structure with smaller
> ammounts of code. Thanks for the help!
> 

The code you posted looks okay (assuming "31.set(text)" is a typo). This 
is very standard usage of Tkinter, so your problem may be somewhere else 
in your code. What happens if you replace disp_mes1() with

def disp_mes1(text):
   print text

Does it still hang?

James



More information about the Python-list mailing list