|
发表于 2021-9-5 10:00:16
|
显示全部楼层
- import tkinter as tk
- import time
- import threading
- class PopupFrame(tk.Toplevel):
- def __init__(self):
- super().__init__()
- self.attributes('-toolwindow', True)
- self.withdraw()
- self.title('emmmm')
- self.geometry('250x150')
- tk.Label(self, text="不能说是模仿,只能说是 一 模 一 样 ", width=150).pack()
- def showFrame(self):
- 左 = root.winfo_x()
- 顶 = root.winfo_rooty() + root.winfo_height()
- self.geometry('+%d+%d' % (左, 顶))
- self.update()
- self.deiconify()
- threading.Thread(target = self.delayHideFrame).start()
- def delayHideFrame(self):
- time.sleep(5)
- try:self.withdraw()
- except:pass
- popFrame = None
- def popupshow():
- global popFrame
- while True:
- try:
- popFrame.showFrame()
- break
- except:
- popFrame = PopupFrame()
- root = tk.Tk()
- root.geometry('150x80')
- tk.Button(root, text='https://im.qq.com/pcqq', width=25, command = popupshow).pack()
- root.mainloop()
复制代码
水个贴都能花10多分钟,绝了 |
|