Simple tkinter query about creating a tk,StringVar() failure

paul.hermeneutic at paul.hermeneutic at
Sat Feb 6 19:38:14 EST 2016

I know this may be more suited to the tutor list. I tried to
subscribe, but no response yet.

Why does this interactive instantiation fail when it seems to work
when run in a script?

(py35-64) C:\src\pygui>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> name = tk.StringVar()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python35\lib\tkinter\", line 329,
in __init__
    Variable.__init__(self, master, value, name)
  File "C:\Program Files\Python35\lib\tkinter\", line 233,
in __init__
    self._root = master._root()
AttributeError: 'NoneType' object has no attribute '_root'

More information about the Python-list mailing list