使用python tkinter實(shí)現(xiàn)各種個(gè)樣的撩妹鼠標(biāo)拖尾效果
python-tkinter 實(shí)現(xiàn)各種個(gè)樣的撩妹鼠標(biāo)拖尾,效果圖展示:
系統(tǒng)的拖尾已經(jīng)無(wú)法滿足我們了,女朋友叫你把鼠標(biāo)拖尾換成她的照片,讓你時(shí)時(shí)刻刻都可以看見(jiàn)她,這個(gè)要求你答不答應(yīng)。
當(dāng)然,這個(gè)要求還是可以滿足一下的,我們來(lái)具體看一看吧。
要制作拖尾,首先,我們需要知道鼠標(biāo)的位置,那有沒(méi)有獲取鼠標(biāo)位置的方法呢?答案當(dāng)然是有的。因此,我們引用到pyautogui模塊
pip install pyautogui
一、系統(tǒng)拖尾
第一種是最簡(jiǎn)單的一種,通過(guò)設(shè)置就可以輕松設(shè)置鼠標(biāo)拖尾,在這里就不詳解了。
二、文藝型拖尾
這個(gè)拖尾殺傷力不大,侮辱性極強(qiáng),給自己增加工作buff。
代碼如下:
import tkinter,time from tkinter import * import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk["background"] = "white" tk.wm_attributes('-transparentcolor', 'white') w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=w, width=h, bg="white") cn.pack() def update_test(e): time.sleep(0.1) cn.delete(tkinter.ALL) tk.update() global a x,y=pyautogui.position()#獲取鼠標(biāo)位置 tk.geometry("180x35+%s+%s" % (x+10, y+10)) cn.create_text(85, 0, text='我的40米大刀') tk.bind("<Configure>", update_test) tk.mainloop()
三、實(shí)用型拖尾
這個(gè)拖尾,可以幫助你找到你容易忘記的東西,比如一些快捷鍵,一些工作的事,讓它隨鼠標(biāo)移動(dòng),隨時(shí)提醒你。
代碼如下:
import tkinter,time from tkinter import * import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk["background"] = "white" tk.wm_attributes('-transparentcolor', 'white') w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=w, width=h, bg="white") cn.pack() def update_test(e): time.sleep(0.1) cn.delete(tkinter.ALL) tk.update() global a x,y=pyautogui.position() tk.geometry("180x35+%s+%s" % (x+10, y+10)) cn.create_text(85, 0, text='ctrl+c 復(fù)制 \n ctrl+v 粘貼', anchor='n') tk.bind("<Configure>", update_test) tk.mainloop()
四、愛(ài)心拖尾
這個(gè)拖尾對(duì)于單身人士來(lái)說(shuō)傷害性極大,這滿滿的愛(ài)意,想要找一個(gè)人快點(diǎn)脫單。哈哈
import tkinter,time from tkinter import * from PIL import ImageTk, Image import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk["background"] = "white" tk.wm_attributes('-transparentcolor', 'white') image1 = Image.open("愛(ài)心.jpg") # 打開(kāi)圖片 image = image1.resize((50,60)) # 設(shè)置圖片大小 photo = ImageTk.PhotoImage(image) # 引入圖片 image2 = Image.open("愛(ài)心.jpg") image3 = image2.resize((101, 121)) # 設(shè)置圖片大小 photo1 = ImageTk.PhotoImage(image3) # 引入圖片 w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=w, width=h, bg="white") cn.pack() a=2 def update_test(e): time.sleep(0.1) cn.delete(tkinter.ALL) tk.update() global a x,y=pyautogui.position() tk.geometry("100x120+%s+%s" % (x+10, y+10)) if a==2: cn.create_image(50, 50, image=photo1) cn.pack() a=1 else: cn.create_image(50, 50, image=photo) cn.pack() a=2 tk.bind("<Configure>", update_test) tk.mainloop()
五、奔跑的火柴人型拖尾
這個(gè)拖尾,可以將圖片替換為其他的動(dòng)作,甚至你還可以直接來(lái)上一部動(dòng)畫(huà)片都可以。
代碼如下:
import tkinter,time from tkinter import * from PIL import ImageTk, Image import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk.wm_attributes('-transparentcolor', '#E0D9BC') w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=h, width=w, bg="white") # bg="pink" list,list1,a,b=[],[],1,1 for i in range(1,8): image1 = Image.open("正向火柴人/123_" + str(i) + ".PNG") # 打開(kāi)圖片 image = image1.resize((100, 100)) # 設(shè)置圖片大小 photo = ImageTk.PhotoImage(image) # 引入圖片 list.append(photo) image1 = Image.open("反向火柴人/123_" + str(i) + ".PNG") # 打開(kāi)圖片 image = image1.resize((100, 100)) # 設(shè)置圖片大小 photo = ImageTk.PhotoImage(image) # 引入圖片 list1.append(photo) def image(list): global a for i in range(1, 8): if a == 7: a = 1 cn.create_image(50, 50, image=list[0]) a += 1 else: cn.create_image(50, 50, image=list[a]) a += 1 break def update_test(e): time.sleep(0.1) tk.update() x,y=pyautogui.position() tk.geometry("100x100+%s+%s"%(x+10,y+10)) global b if x<b:image(list) elif x==b:pass else:image(list1) b=x cn.pack() tk.bind("<Configure>", update_test) tk.mainloop()
六、胡桃搖錢(qián)拖尾
這款拖尾與奔跑的火柴人相似,但又不完全相似,主要是針對(duì)單一動(dòng)畫(huà)制作??梢宰屇闩笥褳槟銛[一整套動(dòng)作,然后移動(dòng)鼠標(biāo)時(shí),你就可以看見(jiàn)你女朋友調(diào)皮的樣子了。
代碼如下:
import tkinter,time from tkinter import * from PIL import ImageTk, Image import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk.wm_attributes('-transparentcolor', '#F7FBFB') w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=h, width=w, bg="#F7FBFB") cn.pack() list,a=[],1 for i in range(1,37): image1 = Image.open("胡桃搖錢(qián)/胡桃搖錢(qián)_" + str(i) + ".JPG") # 打開(kāi)圖片 image = image1.resize((100, 100)) # 設(shè)置圖片大小 photo = ImageTk.PhotoImage(image) # 引入圖片 list.append(photo) def update_test(e): time.sleep(0.05) cn.delete(tkinter.ALL) tk.update() x,y=pyautogui.position() tk.geometry("100x100+%s+%s"%(x+10,y+10)) global a cn.create_image(50, 50, image=list[a]) a=a+1 if a==36:a=1 tk.bind("<Configure>", update_test) tk.mainloop()
七、女朋友或者老婆拖尾
這個(gè)就更強(qiáng)了,一定要給你老婆看一看,你要告訴她,你的拖尾都是她。直接占據(jù)了整個(gè)屏幕。
代碼如下:
import tkinter,time from tkinter import * from PIL import ImageTk, Image import pyautogui tk = tkinter.Tk() tk.overrideredirect(True) tk.wm_attributes('-transparentcolor', '#F7FBFB') w = tk.winfo_screenwidth() # 獲取屏幕寬 h = tk.winfo_screenheight() # 獲取屏幕高 cn = Canvas(tk, height=h, width=w, bg="#F7FBFB") cn.pack() image1 = Image.open("老婆.png") # 打開(kāi)圖片 image = image1.resize((200, 300)) # 設(shè)置圖片大小 photo = ImageTk.PhotoImage(image) # 引入圖片 def update_test(e): time.sleep(0.05) tk.update() x,y=pyautogui.position() tk.geometry("200x300+%s+%s"%(x+10,y+10)) cn.create_image(100, 150, image=photo) tk.bind("<Configure>", update_test) tk.mainloop()
如果鼠標(biāo)拖尾有段位,你屬于哪個(gè)段位
到此這篇關(guān)于使用python tkinter實(shí)現(xiàn)各種個(gè)樣的撩妹鼠標(biāo)拖尾效果的文章就介紹到這了,更多相關(guān)python tkinter鼠標(biāo)拖尾內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Python logging設(shè)置和logger解析
這篇文章主要介紹了Python logging設(shè)置和logger解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08python實(shí)現(xiàn)支付寶轉(zhuǎn)賬接口
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)支付寶轉(zhuǎn)賬接口,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-05-05Pandas實(shí)現(xiàn)在線文件和剪貼板數(shù)據(jù)讀取詳解
這篇文章主要為大家介紹的是Pandas兩種少用的讀取文件方式:讀取在線文件的數(shù)據(jù)和讀取剪貼板的數(shù)據(jù),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2022-06-06python實(shí)現(xiàn)文件分片上傳的接口自動(dòng)化
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)文件分片上傳的接口自動(dòng)化,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11Flask項(xiàng)目中實(shí)現(xiàn)短信驗(yàn)證碼和郵箱驗(yàn)證碼功能
這篇文章主要介紹了Flask項(xiàng)目中實(shí)現(xiàn)短信驗(yàn)證碼和郵箱驗(yàn)證碼功能,需本文通過(guò)截圖實(shí)例代碼的形式給大家介紹的非常詳細(xì),需要的朋友可以參考下2019-12-12jupyter notebook更換皮膚主題的實(shí)現(xiàn)
這篇文章主要介紹了jupyter notebook更換皮膚主題的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01Python?Pandas?中的數(shù)據(jù)結(jié)構(gòu)詳解
這篇文章主要介紹了Python?Pandas?中的數(shù)據(jù)結(jié)構(gòu)詳解,Pandas有三種數(shù)據(jù)結(jié)構(gòu)Series、DataFrame和Panel,文章圍繞主題展開(kāi)更多相關(guān)內(nèi)容需要的小伙伴可以參考一下2022-06-06PyQT5實(shí)現(xiàn)選項(xiàng)卡窗口、堆棧窗口、??看翱凇⒆哟翱?/a>
這篇文章主要介紹了PyQT5實(shí)現(xiàn)選項(xiàng)卡窗口、堆棧窗口、停靠窗口、子窗口,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04解決win10 vscode 無(wú)法激活python 虛擬環(huán)境的問(wèn)題
這篇文章主要介紹了win10 vscode 無(wú)法激活python 虛擬環(huán)境的解決辦法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-10-10