TKinter and Python Sync. Problems

Brian Kazian gtg856h at mail.gatech.edu
Wed Apr 27 23:46:34 EDT 2005


I am currently having trouble running a piece of code I have written.  My 
main code is called new.py, and when I run it, it pops up the TKinter root 
window as specified.  However, if I try perform a function that uses an 
imported module, the code crashes, giving me this error:


Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File "C:\jython\new.py", line 38, in save_var
    var = expression.Variable(name, description)
AttributeError: 'module' object has no attribute 'Variable'

Now, when I close the TKinter window that popped up when the code was 
compiled, an identical one is opened in its place.  If I perform the same 
action as before, the program works flawlessly.  Also worth noting is that 
when this same file is run from SPE, this problem does not ocur.

Does anyone have any idea why this would happen?   I do not understand why a 
new Window is created when I try to close it if run from the command line. 
Also, I don't understand why it can't find the proper module the on the 
first run, but can on the second.  It seems weird that it doesn't also 
happen from the IDE.

Another interesting thing to note is that if I run the module that it chokes 
on intially, ie. 'python expr.py', it brings up the GUI associated with the 
main code.  The problem is, there is no TKinter related code in the expr 
module!

If any additional info or clarification would be helpful, please let me 
know.  Thanks in advance for the help, as I am truly perplexed as to what is 
going on!! 





More information about the Python-list mailing list