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 ...

from Tkinter import *

root = Tk()

my_container = Frame(root, width=100, height=100, bg='red')


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:

    my_container = Frame(root, width=100, height=100, bg='red')
except: pass

What is interesting is that exception is raised only in Debug mode...

- Micko

This question has already been answered. Start a new discussion instead.