JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
about 6 hours ago3 views
👨‍💻Programming

Untitled Page

import tkinter as tk

okno = tk.Tk()
okno.title("Pozycja kursora")
okno.geometry("400x300")

def pokaz_pozycje():
    x = okno.winfo_pointerx() - okno.winfo_rootx()
    y = okno.winfo_pointery() - okno.winfo_rooty()

    pozycja.config(text=f"Pozycja kursora: X = {x}, Y = {y}")

    okno.after(100, pokaz_pozycje)

def najazd(event):
    przycisk.config(bg="blue")
    napis.config(text="Kursor nad przyciskiem!")

def zjazd(event):
    przycisk.config(bg="lightgray")
    napis.config(text="Kursor poza przyciskiem")

pozycja = tk.Label(okno, text="Pozycja kursora: X = 0, Y = 0")
pozycja.pack(pady=20)

przycisk = tk.Button(okno, text="Najedź na mnie", bg="lightgray")
przycisk.pack(pady=20)

przycisk.bind("<Enter>", najazd)
przycisk.bind("<Leave>", zjazd)

napis = tk.Label(okno, text="Kursor poza przyciskiem")
napis.pack(pady=20)

pokaz_pozycje()

okno.mainloop()
← Back to timeline