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 terry.reedy
Recipients amiraliemami, terry.reedy
Date 2019-09-27.21:56:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
You neglected to state the observation that led to the conclusion of 'not linked'.  Using 3.8 on Win10, I replaced "plt.set_cmap('x')" with "tk.Tk()".  Then, clicking the button prints 'False' even when the checkbutton is checked.  After either removing 'tk.Tk()' *or* changing 'BooleanVar()' to 'BooleanVar(root)', button clicks print 'True' when the checkbutton is checked.

Explanation of what I see: tkinter has attribute tkinter._default_root initialized to None.  By default, this is rebound to the *first* root created by an internal or user tkinter.Tk() call.  Barring exceptional circumstances, one should either always use the default root and never create and pass a named root *or* never use the default one and create a named root and always pass it.  Your program is buggy in using the default root for the var and the named root for the buttons.  When the two are different, the expected linkage does not work.

I assume that you see the same failure with the code you posted and the same fix after (re)moving the .set_cmap call.  So I am further assuming that set_cmap somehow results in a default root being created and that fixing the buggy BooleanVar call will also fix things.

To test the set_cmap assumption, add "print(tk._default_root)" *before*  "root = tk.Tk()".  Do you see 'None' or '.'?  Does adding 'root' to the var call fix the link?  If you seen 'None' and the link still does not work, then 'set_cmap' must be affecting tkinter some other way, which would likely be a 3rd party bug in that function or pyplot.
Date User Action Args
2019-09-27 21:56:04terry.reedysetrecipients: + terry.reedy, amiraliemami
2019-09-27 21:56:04terry.reedysetmessageid: <>
2019-09-27 21:56:04terry.reedylinkissue38292 messages
2019-09-27 21:56:04terry.reedycreate