473,769 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

_tkinter.TclErr or: 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.ro ot)
self.frame = Tk.Frame(self.r oot)
self.var = Tk.StringVar()
self.var.trace_ variable('w',se lf.check)
Tk.Entry(self.f rame, 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.global setvar(self._na me, value)
_tkinter.TclErr or: can't set "PY_VAR0": invalid command name
"-1210125972check "
Any ideas, why I cant set the variable var?

--
Greg
Mar 2 '06 #1
1 5237
Gregor Horvath schrieb:
if __name__ == "__main__":
t = testtk()
t.var.set("TEST ")

Result:

_tkinter.TclErr or: 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
6242
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; like telnet is a client. The user should be able to bind() to a port and wait for a client. The written and recieved data is stored in a Text widget, self.__text. The accept()ing is done in a seperate thread (using the threading module), in...
1
3890
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 get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
8
64835
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 User_Lecturer L, User_Student S, TBL_Intake I, Users U 4 WHERE L.UserID=S.InitialSupervisorID And L.UserID=U.UserID And
0
1485
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 asp.net page I get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
10
21011
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 is a login named "Tester". In its property window, NO "Server Roles" was assigned but its "Database Access" was set to "TestDB". This login was also made as the user of "TestDB" with "public", "db_datareader" and "db_datawriter" selected as its...
0
1607
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: iso-8859-2 -*- set client_encoding to LATIN2; create table t (txt text); begin; --inserted character is latin small letter r with caron, coded in iso 8859-2 insert into t values ('Å™');
1
5581
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 received that contains a "`" character I get the exception listed above; and the call stack listed below. Questions; 1) Where can I find more documentation on the FileChangesMonitor class?
0
1620
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 get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
3
7422
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". Mixed mode authentication specified and sa password specified. Used server manager to create user login with sysadmin role. Login using windows authentication. Run my application and database is created and populated with default records.
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.