Search code examples
pythontkinterwing-ide

Incorrect stack data in Wing IDE with Tkinter?


I am using Wing to write and debug a Tkinter GUI. I am finding that the Stack Data View doesn't seem to match the actual attributes of my widgets. Take this code for example:

import Tkinter
import ttk

root = Tkinter.Tk()
checkbutton = ttk.Checkbutton(root, text="Test Check Button")
print checkbutton.text

This gives me an attribute error at the last line. However, when I look at the stack, there is clearly an attribute called 'text' with the value that I'm looking for:

Wing screen capture

Anyone know what's going on?

I'm using:

  • Wing version: Wing IDE Pro 5.1.3-1 (rev 33002)
  • Tkinter version: '$Revision: 81008 $'
  • Python version: 2.7.10

Solution

  • I posted this to the Wing email list, and I got the following response from the developers:

    It looks like a ttk.Checkbutton defines keys() and __getitem__() methods to exposes tk attributes via checkbutton[<name>]. Because of the keys() and __getitem__(), Wing is displaying the instance as if it were a dictionary, with the keys and values interspersed with the attributes. Wing does this because often you want to view an object that defines keys() and __getitem__() as if it were a dictionary, but I agree that it's confusing in this instance.

    We'll try to improve this in a future release.