发布网友 发布时间:2022-04-21 01:26
共1个回答
热心网友 时间:2022-06-17 02:30
给你百度一个吧 import Tkinterroot = Tkinter.Tk()root.overrideredirect(True)#root.attributes("-alpha", 0.3)窗口透明度70 %root.attributes("-alpha", 0.4)#窗口透明度60 %root.geometry("300x200+10+10")canvas = Tkinter.Canvas(root)canvas.configure(width = 300)canvas.configure(height = 200)canvas.configure(bg = "blue")canvas.configure(highlightthickness = 0)canvas.pack()x, y = 0, 0def move(event): global x,y new_x = (event.x-x)+root.winfo_x() new_y = (event.y-y)+root.winfo_y() s = "300x200+" + str(new_x)+"+" + str(new_y) root.geometry(s) print("s = ",s) print(root.winfo_x(),root.winfo_y()) print(event.x,event.y) print()def button_1(event): global x,y x,y = event.x,event.y print("event.x, event.y = ",event.x,event.y)canvas.bind("<B1-Motion>",move)canvas.bind("<Button-1>",button_1)root.mainloop()#自己加个双击鼠标事件 关闭窗口 不然结束程序很不爽 要关闭IDE