New submission from Lyndon D'Arcy :
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.
--
assignee: docs@python
components: Documentation, Tkinter
messages: 400403
nosy: docs@python, lyndon.darcy
priority: normal
severity: normal
status: open
title: tkinter doc, hello world example - quit button clobbers method
versions: Python 3.9
___
Python tracker
<https://bugs.python.org/issue45029>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com