Kể cả Pycharm cũng vậy ạ:
From tkinter import *
Import time
Def make_center (root) :
Root. Update_idletasks () # Cập nhật các widget trong cửa sổ
Width = root. Winfo_width () # Lấy chiều rộng hiện tại của cửa sổ
Height = root. Winfo_height () # Lấy chiều cao hiện tại của cửa sổ
Screen_width = root. Winfo_screenwidth () # Lấy chiều rộng màn hình
Screen_height = root. Winfo_screenheight () # Lấy chiều cao màn hình
X = (screen_width - width) // 2 # căn giữa
Y = (screen_height - height) // 2 # căn giữa
Root. Geometry (f "{width}x{height}+{x}+{y}") # Đặt lại kích thước và vị trí của cửa sổ
Root=Tk ()
Root. Title ( "caculator")
Root. Resizable (height=1000, width=1400)
Root. Minsize (height=550, width=530)
StringVarA= StringVar
Make_center (root)
Def show_label () :
Label (root, text= "Caculator", justify=CENTER, relief=SUNKEN). Pack (side=LEFT, padx=10). Grid (row=0, columnspan=2)
#photo=Photo. Imagine (file=" ")
Button (root, text=" x", textvar=StringVarA). Pack (side=RIGHT)
#root. After (2000, show_label)
#time. Sleep (2)
Root. Mainloop ()