Please support our Python advertiser: Programming Forums
Views: 1818 | Replies: 2
![]() |
•
•
Join Date: Aug 2005
Location: Bosnia and Herzegovina
Posts: 147
Reputation:
Rep Power: 4
Solved Threads: 1
Hello,
I start learning Python GUI using Tkinter
as IDE I'm using wing IDE 2.0.3 trial.
I'm using Tkinter mainly because of very good debugger.
Belive it or not I get exception in this code:
Exception is generated in file Tkinter.py in line:
and Exception message is:
However, if I just execute file everything seems to work, I tried in IDLE and there
are no exceptions there. What could that be, maybe it's an IDE bug?
I start learning Python GUI using Tkinter
as IDE I'm using wing IDE 2.0.3 trial.
I'm using Tkinter mainly because of very good debugger.
Belive it or not I get exception in this code:
from Tkinter import * root = Tk ( ) my_container = Frame ( root )
Exception is generated in file Tkinter.py in line:
def __getattr__(self, attr):
"Delegate attribute access to the interpreter object"
return getattr(self.tk, attr)and Exception message is:
AttributeError: __nonzero__
Traceback (innermost last):
File "c:\PythonProjects\GUILearning\SimpleGUI2.py", line 1, in ?
from Tkinter import *
File "c:\PythonProjects\GUILearning\SimpleGUI2.py", line 5, in ?
my_container = Frame(root)
File "C:\Python24\Lib\lib-tk\Tkinter.py", line 2374, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "C:\Python24\Lib\lib-tk\Tkinter.py", line 1855, in __init__
BaseWidget._setup(self, master, cnf)
File "C:\Python24\Lib\lib-tk\Tkinter.py", line 1828, in _setup
if not master:
File "C:\Python24\Lib\lib-tk\Tkinter.py", line 1647, in __getattr__
return getattr(self.tk, attr)However, if I just execute file everything seems to work, I tried in IDLE and there
are no exceptions there. What could that be, maybe it's an IDE bug?
Since the frame is empty and you are not packing it into the root, my IDE ignores it, no errors. Your IDE may have a lint filter built in and looks at this as uncompleted code!
This would be the more normal way to do something with a frame ...
This would be the more normal way to do something with a frame ...
from Tkinter import * root = Tk() my_container = Frame(root, width=100, height=100, bg='red') my_container.pack() root.mainloop()
May 'the Google' be with you!
•
•
Join Date: Aug 2005
Location: Bosnia and Herzegovina
Posts: 147
Reputation:
Rep Power: 4
Solved Threads: 1
It's same exception again!
in line:
my_container = Frame(root, width=100, height=100, bg='red')
so to get rid off it I write:
What is interesting is that exception is raised only in Debug mode...
- Micko
in line:
my_container = Frame(root, width=100, height=100, bg='red')
so to get rid off it I write:
try:
my_container = Frame(root, width=100, height=100, bg='red')
except: pass- Micko
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode