Fix tkinter regression introduced by the security fix in #16248.