Python3.6 tkinter bug?

George Trojan - NOAA Federal george.trojan at noaa.gov
Tue Jan 31 14:18:58 EST 2017


The following program behaves differently under Python 3.6:

'''
checkbutton test
'''

import tkinter

class GUI(tkinter.Tk):
    def __init__(self):
        tkinter.Tk.__init__(self)
        frame = tkinter.Frame(self)
        for tag in ('A', 'B'):
            w = tkinter.Checkbutton(frame, text=tag)
            w.pack(side='top', padx=10, pady=10)
            print(w)
        frame.pack(side='top')
        frame = tkinter.Frame(self)
        for tag in ('C', 'D'):
            w = tkinter.Checkbutton(frame, text=tag)
            w.pack(side='top', padx=10, pady=10)
            print(w)
        frame.pack(side='top')

gui = GUI()
gui.mainloop()

Selection of button 'A' also selects button 'C'. Same goes for 'B' and 'D'.
I noticed that widget names have changed, which likely leads to the cause:

> /usr/local/Python-3.5.1/bin/python3 foo.py
.140182648425776.140182647743208
.140182648425776.140182647841848
.140182648424152.140182648282080
.140182648424152.140182648282136

> /usr/local/Python-3.6.0/bin/python3 foo.py
.!frame.!checkbutton
.!frame.!checkbutton2
.!frame2.!checkbutton
.!frame2.!checkbutton2

Is this a known issue?

George



More information about the Python-list mailing list