You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tkinter doc, hello world example - quit button clobbers method #89192
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.
The help(app.quit) which I posted is what we should get when the method
isn't clobbered.
What Serhiy has posted is what you get after running the example as-is. It
shows that after running the example self.quit refers to a button object
instead of the quit method.
On Fri, 27 Aug 2021 at 7:38 pm, Serhiy Storchaka <[email protected]>
wrote:
Activity
lyndondarcy commentedon Aug 27, 2021
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.
-------------------------------------------------------
>>> 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.
serhiy-storchaka commentedon Aug 27, 2021
I get different result:
>>> app.quit <tkinter.Button object .!application.!button2> >>> help(app.quit) Help on Button in module tkinter object:lyndondarcy commentedon Aug 27, 2021
Apologies, my original post was unclear.
The help(app.quit) which I posted is what we should get when the method
isn't clobbered.
What Serhiy has posted is what you get after running the example as-is. It
shows that after running the example self.quit refers to a button object
instead of the quit method.
On Fri, 27 Aug 2021 at 7:38 pm, Serhiy Storchaka <[email protected]>
wrote:
E-Paine commentedon Aug 27, 2021
Thanks for reporting this issue. This was (very) recently fixed in bpo-42560 / PR27842. These changes include a new hello world example and can be seen in the 3.10 / 3.11 docs (https://docs.python.org/3.10/library/tkinter.html#a-hello-world-program). This change was backported to 3.9 docs, but the build bots have yet to rebuild the version hosted on docs.python.org.
terryjreedy commentedon Aug 28, 2021
For whatever reason, the 3.9 backport, PR-27911, was closed. In any case, we will not edit the code we have replaced.
Lyndon, when responding by email, please delete the old text as it is redundant and noisy when your email is added to the web page.