I'm trying to create a transparent layer on top of the whole screen and display pointer position.
This is what I'm playing with:
#!/usr/bin/python3
import tkinter as tk
from tkinter import ttk
def hover( root, lb):
x,y = root.winfo_pointerxy()
lb['text'] = f"X={x}\nY={y}"
lb.place( x=x, y=y)
root.after( 200, hover, root, lb)
def createGlass():
root = tk.Tk()
root.wm_attributes( "-alpha", 0.0)
root.wm_attributes( "-fullscreen", 1)
#root.wm_overrideredirect( True)
lb = ttk.Label( root)
lb.place( x=0, y=0)
hover( root, lb)
root.mainloop()
if __name__ == '__main__':
createGlass()
Program works fine except that the layer is opaque and transparency is required. Platform is Linux 5.10 and tkInter is 8.6