This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author John Hagen
Recipients John Hagen, SilentGhost, berker.peksag, docs@python, terry.reedy
Date 2016-07-06.12:41:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467808906.95.0.448539576218.issue27455@psf.upfronthosting.co.za>
In-reply-to
Content
@Terry I've removed the two string quotes changes in the latest patch.

@Berker I spent a small amount of time trying out your proposed super() changes, but could not get them to work on 3.5.1.

"C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\python.exe" "C:/Users/John Hagen/PycharmProjects/test/test.py"
Traceback (most recent call last):
  File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 25, in <module>
    app = Application(master=root)
  File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 6, in __init__
    super().__init__(self, master)
  File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2583, in __init__
    Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2131, in __init__
    BaseWidget._setup(self, master, cnf)
  File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2109, in _setup
    self.tk = master.tk
AttributeError: 'Application' object has no attribute 'tk'

--------------------

import tkinter as tk


class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(self, master)
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.hi_there = tk.Button(self)
        self.hi_there["text"] = "Hello World\n(click me)"
        self.hi_there["command"] = self.say_hi
        self.hi_there.pack(side="top")

        self.quit = tk.Button(self, text="QUIT", fg="red",
                              command=root.destroy)
        self.quit.pack(side="bottom")

    def say_hi(self):
        print("hi there, everyone!")


root = tk.Tk()
app = Application(master=root)
app.mainloop()
History
Date User Action Args
2016-07-06 12:41:47John Hagensetrecipients: + John Hagen, terry.reedy, SilentGhost, docs@python, berker.peksag
2016-07-06 12:41:46John Hagensetmessageid: <1467808906.95.0.448539576218.issue27455@psf.upfronthosting.co.za>
2016-07-06 12:41:46John Hagenlinkissue27455 messages
2016-07-06 12:41:46John Hagencreate