Skip to content

tkinter events not working since Python 3.14 w/ TK 9.0 #141237

@der-eismann

Description

@der-eismann

Bug report

Bug description:

Hey everyone, I tried updating an application that uses tkinter from Python 3.12 to 3.14, however it stopped working. After spending some time debugging and testing I found that 3.13 works fine, but ultimately it stops working with 3.14, probably because of the upgrade to TCL/TK 9.0.
Essentially it looks like the event bindings are broken, at least the handlers are not called when an event is generated. I couldn't find anything in the changelogs so far. Here's a minimal example that I can run on Fedora with 3.12 and 3.13, but not with 3.14 (taken from here:

import threading
import time
import queue
from tkinter import *

ws = Tk()
ws.geometry("200x200")
comque= queue.Queue()

def timeThread():
    prestime = 0
    while 1:
        comque.put(prestime)
        
        try:
            ws.event_generate('<<TimeChanged>>', when='tail')
        except TclError:
            break
        time.sleep(1)
        prestime += 1

clcvar = IntVar()
Label(ws, textvariable=clcvar, width=9).pack(pady=10)

def timeChanged(event):
    clcvar.set(comque.get())

ws.bind('<<TimeChanged>>', timeChanged)
Thr=threading.Thread(target=timeThread)
Thr.start()

ws.mainloop()

Thanks in advance!

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions