_tkinter.TclError: can't set "PY_VAR0": invalid command name "-1210125972check"

Gregor Horvath g.horvath at gmx.at
Thu Mar 2 12:55:32 EST 2006


Gregor Horvath schrieb:

> if __name__ == "__main__":
>   t = testtk()
>   t.var.set("TEST")
> 
> Result:
> 
> _tkinter.TclError: can't set "PY_VAR0": invalid command name 
> "-1210125972check"
> 
> 
> Any ideas, why I cant set the variable var?

Ok. The problem is that the program enters the mainloop on t = testtk() 
and t.var.set("TEST") is executed when the program ends.

But, what I want to do is to let another program create my tkinter GUI 
via initiating my class through COM. Then the COM-Client should be able 
to set values of the tkinter variables from "the outside".

How to do this?

Do I have to make my GUI program threaded ? like described here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965

The mainloop resides in one thread and the other thread provides the COM
object and queues the foreign COM method calls to the GUI thread?

Is there a simpler solution?

--
Greg



More information about the Python-list mailing list