| | |
Tkinter exception
![]() |
•
•
Join Date: Aug 2005
Posts: 148
Reputation:
Solved Threads: 6
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:
Python Syntax (Toggle Plain Text)
from Tkinter import * root = Tk ( ) my_container = Frame ( root )
Exception is generated in file Tkinter.py in line:
Python Syntax (Toggle Plain Text)
def __getattr__(self, attr): "Delegate attribute access to the interpreter object" return getattr(self.tk, attr)
and Exception message is:
Python Syntax (Toggle Plain Text)
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 ...
Python Syntax (Toggle Plain Text)
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
Posts: 148
Reputation:
Solved Threads: 6
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:
Python Syntax (Toggle Plain Text)
try: my_container = Frame(root, width=100, height=100, bg='red') except: pass
- Micko
![]() |
Similar Threads
- Tkinter EntryBox (Python)
- Tkinter: protecting text in the Entry widget (Python)
- fatal exception OE VXD VFAT (Windows 95 / 98 / Me)
- Exception messages reappears constantly! (Windows NT / 2000 / XP)
- Arithmetic Exceptions and exception-handling statements (Java)
Other Threads in the Python Forum
- Previous Thread: TKinter tough time
- Next Thread: using distutils to install a python module
| Thread Tools | Search this Thread |
alarm ansi assignment avogadro backend beginner binary bluetooth character cmd code customdialog cx-freeze data decimals dictionary directory dynamic error examples exe file float format function generator gnu graphics gui halp heads homework http ideas import input itunes java leftmouse line linux list lists loop maze module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext slicenotation sqlite ssh statistics string strings sudokusolver sum terminal text thread threading time tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 variable ventrilo vigenere web webservice wikipedia write wxpython xlib






