Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why or how does resizeable() solve my "two tk" problem

Like many others, I suffered from seeing an 'extra window' titled 'tk'. None of the answers helped, until I stumbled on the solution shown below:

import tkinter as tk
root = tk.Tk()
root.geometry('500x500')

########### Comment out to see the 'two tk' problem
root.resizable(width=False, height=False)
###########

button = tk.Button(root)
button["text"]= 'X'
button.pack()
root.mainloop()

I'm running under OSX 10.15.2, with Python 3.8.

Any ideas? I appreciate it might just be my system, but I am interested in what might be causing this. And it's nothing to do with the IDE - the problem is the same when running direct from Terminal:

$ python3.8 two_tks.py

While 'resizable' solves my problem in the real app, I still would like to solve it. Both Python 3.8 and tkinter and catalina are recent installations

Proof pic:

two windows as not expected

like image 308
John White Avatar asked Nov 24 '25 10:11

John White


1 Answers

I tried under OSX 10.14.6 with Anaconda Python 3.6.9. However, I had no double window problem.

Screenshot

Maybe there is a problem with the IDE you are using?

like image 193
Muhammet Emin TURGUT Avatar answered Nov 28 '25 15:11

Muhammet Emin TURGUT