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 lyndon.darcy
Recipients docs@python, lyndon.darcy
Date 2021-08-27.09:03:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630055004.62.0.378999176997.issue45029@roundup.psfhosted.org>
In-reply-to
Content
Below is the example as it is.  Currently self.quit clobbers a built-in method of the same name.  I would suggest renaming self.quit to self.quit_button or similar.

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

import tkinter as tk

class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = 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=self.master.destroy)
        self.quit.pack(side="bottom")

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

root = tk.Tk()
app = Application(master=root)
app.mainloop()

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

>>> help(app.quit)
Help on method quit in module tkinter:

quit() method of __main__.Application instance
    Quit the Tcl interpreter. All widgets will be destroyed.
History
Date User Action Args
2021-08-27 09:03:24lyndon.darcysetrecipients: + lyndon.darcy, docs@python
2021-08-27 09:03:24lyndon.darcysetmessageid: <1630055004.62.0.378999176997.issue45029@roundup.psfhosted.org>
2021-08-27 09:03:24lyndon.darcylinkissue45029 messages
2021-08-27 09:03:24lyndon.darcycreate