0

I find it really strange that the keys() method on the Tkinter.Canvas class returns a list of empty strings. Am I missing something, for other widgets those fields are populated with the correct options.

enter image description here

9
  • That looks like a bug. Jan 20, 2016 at 22:20
  • @BryanOakley ... wonderful Jan 20, 2016 at 22:22
  • Why does it matter? What are you trying to accomplish? There are other ways to programmatically get all of the configuration options. Jan 20, 2016 at 22:34
  • @BryanOakley I don't need the configured options. I need the options available to configure for canvas. I'm building an xml based styling abstraction on top of tkinter so I need to check if the option tags in the xml file for the widget are valid. Jan 20, 2016 at 22:36
  • @BryanOakley I agree that the Canvas-specific failure is a bug. I tracked down the causes and opened a tracker issue with a proposed remedy (trivial). bugs.python.org/issue26177 Jan 22, 2016 at 7:00

1 Answer 1

0

That appears to be a bug. However, you can get a list of all of the available options with the configure command:

c = tk.Canvas(...)
print(c.configure().keys())
1
  • In 3.x, this gives a view object, not a list. `sorted[c.configure().keys()] gives a sorted list like with other-widget.keys() Jan 22, 2016 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.