classification
Title: IntVar() - AttributeError: 'NoneType' object has no attribute 'tk'
Type: behavior Stage:
Components: Tkinter Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Plazma
Priority: normal Keywords:

Created on 2010-02-11 21:20 by Plazma, last changed 2010-02-11 21:57 by brian.curtin. This issue is now closed.

Files
File name Uploaded Description Edit
intvar-POC.py Plazma, 2010-02-11 21:20 IntVar - Test Code - intvar-POC.py
intvar-POC.py Plazma, 2010-02-11 21:48
Messages (2)
msg99238 - (view) Author: Nick (Plazma) Date: 2010-02-11 21:20
I tried to run the attached code and it seems IntVar() dies in the Tkinter module. After discussion with several other coworkers they seem to agree this may be a bug in Tkinter. If you need more info feel free to let me know and I can help with further testing.

OS: Windows XP 32-bit SP2
Python: Python 3.1.1

Error:

Traceback (most recent call last):
  File "H:/code/python/hfprog_sounds/intvar-POC.py", line 3, in <module>
    num_good = IntVar()
  File "C:\Python31\lib\tkinter\__init__.py", line 265, in __init__
    Variable.__init__(self, master, value, name)
  File "C:\Python31\lib\tkinter\__init__.py", line 174, in __init__
    self._tk = master.tk
AttributeError: 'NoneType' object has no attribute 'tk'
msg99240 - (view) Author: Nick (Plazma) Date: 2010-02-11 21:48
Ok this was my own mistake and not a bug.. really sorry about this.

Moving the following code ABOVE the IntVar() calls allows it to work:

app = Tk()
app.title("TESTING")
app.geometry('300x100+200+100')

See revised attached
History
Date User Action Args
2010-02-11 21:57:44brian.curtinsettype: compile error -> behavior
resolution: not a bug
2010-02-11 21:48:12Plazmasetstatus: open -> closed
files: + intvar-POC.py
messages: + msg99240
2010-02-11 21:20:19Plazmacreate