SoFunction
Updated on 2024-11-13

Use python tkinter to realize various kinds of mouse trailing effects for girls.

python-tkinter Realize various kinds of mouse trailing to tease the girl, the effect of the picture shows:

The system's trailing is no longer able to satisfy us, your girlfriend asks you to change the mouse trailing to her photo, so that you can see her all the time, this request you answer or not.

Of course, this requirement can still be met a bit, so let's take a look at it in detail.

To create a trailing, first of all, we need to know the position of the mouse, then there is no way to get the mouse position? The answer is of course there is. Therefore, we refer to the pyautogui module

pip install pyautogui

I. System trailing

The first is the simplest one, through the settings can easily set the mouse trailing, not detailed here.

Second, literary type trailing tail

This drag kills little, insults extremely well, and adds work buffs to itself.

The code is as follows:

import tkinter,time
from tkinter import *
import pyautogui
​
tk = ()
(True)
tk["background"] = "white"
tk.wm_attributes('-transparentcolor', 'white')
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
​
cn = Canvas(tk, height=w, width=h, bg="white")
()
def update_test(e):
    (0.1)
    ()
    ()
    global a
    x,y=()# Get mouse position
    ("180x35+%s+%s" % (x+10, y+10))
    cn.create_text(85, 0, text="My 40-meter machete.)
("<Configure>", update_test)
()

III. Practical Tail Drag

This trailing, can help you find things you tend to forget, like some shortcuts, some work things, and let it move with your mouse to remind you anytime.

The code is as follows:

import tkinter,time
from tkinter import *
import pyautogui
​
tk = ()
(True)
tk["background"] = "white"
tk.wm_attributes('-transparentcolor', 'white')
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
​
cn = Canvas(tk, height=w, width=h, bg="white")
()
def update_test(e):
    (0.1)
    ()
    ()
    global a
    x,y=()
    ("180x35+%s+%s" % (x+10, y+10))
    cn.create_text(85, 0, text='ctrl+c copy \n ctrl+v paste', anchor='n')
("<Configure>", update_test)
()

Fourth, love drag tail

This mop-tail is extremely damaging for singles, it's full of love and wanting to find someone to get off quickly. Haha

import tkinter,time
from tkinter import *
from PIL import ImageTk, Image
import pyautogui
​
tk = ()
(True)
tk["background"] = "white"
tk.wm_attributes('-transparentcolor', 'white')
​
image1 = ("Love.jpg.")  # Open the picture
image = ((50,60))  # Setting the image size
photo = (image)  # Introducing Images
​
image2 = ("Love.jpg.")
image3 = ((101, 121))  # Setting the image size
photo1 = (image3)  # Introducing Images
​
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
​
cn = Canvas(tk, height=w, width=h, bg="white")
()
a=2
def update_test(e):
    (0.1)
    ()
    ()
    global a
    x,y=()
    ("100x120+%s+%s" % (x+10, y+10))
    if a==2:
        cn.create_image(50, 50, image=photo1)
        ()
        a=1
    else:
        cn.create_image(50, 50, image=photo)
        ()
        a=2
("<Configure>", update_test)
()

V. Running Matchmaker-type Drag Tail

This trailing, you can replace the picture with other actions, and you can even just come up with an animated movie all together.

The code is as follows:

import tkinter,time
from tkinter import *
from PIL import ImageTk, Image
import pyautogui
​
tk = ()
(True)
tk.wm_attributes('-transparentcolor', '#E0D9BC')
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
cn = Canvas(tk, height=h, width=w, bg="white")  # bg="pink"
list,list1,a,b=[],[],1,1
for i in range(1,8):
    image1 = ("Positive Matchmaker/123_" + str(i) + ".PNG")  # Open the picture
    image = ((100, 100))  # Setting the image size
    photo = (image)  # Introducing Images
    (photo)
    image1 = ("Reverse Matchmaker/123_" + str(i) + ".PNG")  # Open the picture
    image = ((100, 100))  # Setting the image size
    photo = (image)  # Introducing Images
    (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):
    (0.1)
    ()
    x,y=()
    ("100x100+%s+%s"%(x+10,y+10))
    global b
    if x<b:image(list)
    elif x==b:pass
    else:image(list1)
    b=x
    ()
("<Configure>", update_test)
()

VI. Walnut Shaker Trailer

Similar to Running Matchmaker, but not quite, this trailing tail is made primarily for single animations. You can have your girlfriend pose a whole set of moves for you, and then when you move the mouse, you can see your girlfriend being naughty.

The code is as follows:

import tkinter,time
from tkinter import *
from PIL import ImageTk, Image
import pyautogui
​
tk = ()
(True)
tk.wm_attributes('-transparentcolor', '#F7FBFB')
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
cn = Canvas(tk, height=h, width=w, bg="#F7FBFB")
()
list,a=[],1
for i in range(1,37):
    image1 = ("Pecan Shake / Pecan Shake_" + str(i) + ".JPG")  # Open the picture
    image = ((100, 100))  # Setting the image size
    photo = (image)  # Introducing Images
    (photo)
​
def update_test(e):
    (0.05)
    ()
    ()
    x,y=()
    ("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
("<Configure>", update_test)
()

Seven, girlfriend or wife trailing

This one is even stronger, make sure you show it to your wife, you'll have to tell her that your drag is all about her. It takes up the whole screen straight away.

The code is as follows:

import tkinter,time
from tkinter import *
from PIL import ImageTk, Image
import pyautogui
​
tk = ()
(True)
tk.wm_attributes('-transparentcolor', '#F7FBFB')
w = tk.winfo_screenwidth()  # Get screen width
h = tk.winfo_screenheight()  # Get screen height
cn = Canvas(tk, height=h, width=w, bg="#F7FBFB")
()
​
image1 = ("Wife.png.")  # Open the picture
image = ((200, 300))  # Setting the image size
photo = (image)  # Introducing Images
​
def update_test(e):
    (0.05)
    ()
    x,y=()
    ("200x300+%s+%s"%(x+10,y+10))
    cn.create_image(100, 150, image=photo)
("<Configure>", update_test)
()

If the mouse trailer has segments, which segment do you belong to?

to this article on the use of python tkinter to achieve a variety of different kinds of tease the mouse trailing effect of the article is introduced to this, more related python tkinter mouse trailing content, please search for my previous articles or continue to browse the following related articles I hope that you will support me in the future more!