473,396 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Hi,

I searched the web and docs but cannot figure out whats wrong with this
code:

#!/usr/bin/python

import Tkinter as Tk

class testtk(Tk.Frame):

def __init__(self):
self.root = Tk.Tk()
Tk.Frame.__init__(self,self.root)
self.frame = Tk.Frame(self.root)
self.var = Tk.StringVar()
self.var.trace_variable('w',self.check)
Tk.Entry(self.frame, textvariable = self.var).pack()
self.frame.pack()
Tk.mainloop()

def check():
pass

if __name__ == "__main__":
t = testtk()
t.var.set("TEST")

Result:

Traceback (most recent call last):
File "<stdin>", line 22, in ?
File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 191, in set
return self._tk.globalsetvar(self._name, value)
_tkinter.TclError: can't set "PY_VAR0": invalid command name
"-1210125972check"
Any ideas, why I cant set the variable var?

--
Greg
Mar 2 '06 #1
1 5178
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/Coo...n/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
Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Schutte | last post by:
I know, questions about Tkinter and threads have been answered very often, but I want to ask anyway. I am using Python 2.2 on a Linux (SuSE Linux 8.1) system. I want to write a server application;...
1
by: Ron | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
8
by: Shino | last post by:
Hi, Can anyone help with this error: "ORA-00904: invalid column name"? Thanks! SQL> create view PPFa as 2 SELECT L.UserID AS LecID, U.Name, U.Email, I.IntakeID, S.UserID AS StudID 3 FROM...
0
by: simpsoro | last post by:
I am trying to run asp.net pages. The server is accessed by students via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and...
10
by: FreeOperator | last post by:
Dear all, On Win2000 server with SP3, I am trying to access a SQL Server 7.0 database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO 2.7. In SQL Server Enterprise Manager, there...
0
by: Jan Poslusny | last post by:
Hallo, we runs PostgreSQL 7.3.4 on RedHat 9. I initialized dbcluster with --locale=cs_CZ.UTF-8 and created database with --encoding=unicode. But following script generates error: -- -*- coding:...
1
by: MarkWH | last post by:
I am writing a simple reverse proxy using .Net. The basic design is to capture all traffic (from all URL's) in an HttpHandler and the respond accordingly. The problem is that I when a URL is...
0
by: Ron Simpson | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I...
3
by: ianforgroupuse | last post by:
I'm running Vista Business edition on 2005 Virtual PC. Installed SQL Server 2005 Express latest download, with instance of MSSQLSERVER and service accounts running under "NT AUTHORITY\SYSTEM"....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.