当输入小部件在画布上并单击时,该窗口会产生我想避免的效果。 这是一个示例,这样您就可以看到即时消息在说什么:
import tkinter as tk
class GUI:
def __init__(self, master, x, y):
self.canvas = tk.Canvas(master, width=x, height=y)
self.canvas.pack()
self.entry = tk.Entry(self.canvas)
p0x, p0y = x/2, y/2
self.canvas.create_window(p0x, p0y, anchor="center", window=self.entry)
xroot = 1080
yroot = 720
root = tk.Tk()
gui = GUI(root, xroot, yroot)
root.mainloop()