首页 > 解决方案 > 获取_tkinter.TclError:错误的几何说明符“400 * 400”

问题描述

我有这个代码:

from tkinter import *

from tkinter import messagebox
root = Tk()
root.title('Popup')
root.iconbitmap('D:/Test/Hulk.ico')
root.geometry("400*400")
def popup():
    response = messagebox.showinfo("Popup Test...", "Hello Stifler !")
    Label(root, text=response).pack()

Button(root, text="Click Me!", command=popup).pack()
mainloop()

标签: pythontkinter

解决方案


它应该是:

root.geometry("400x400")

*应替换为x.


推荐阅读