Hi,

On Wed, 11 May 2022 22:34:00 -0400
lou <loushanguan2...@sina.com> wrote:

> 
> Thank Michael Lange!
> 
> it's what i need, and it works fine in twm

I am glad if I could help.

Btw, I noticed there is a small bug in the script, there should be an
additional line towards the script's end, so that the end of the script
looks like:

root.bind('<1>', quit)
for sig in (2, 3, 6, 15):
    signal(sig, quit)
root.wm_protocol('WM_DELETE_WINDOW', quit) # I forgot this the other day
root.update_idletasks()
start()
root.deiconify()
root.mainloop()
root.destroy()


There shouldn't happen anything nasty without this "WM-protocol" handler,
however when the window is removed by the window manager, without this
line some ugly "crash message" might show up.

> 
> no wonder python is so popular these days

I guess this could be done with even fewer lines of code when written in
Tcl/Tk, I am just more familiar with Python ;)

> 
> PS: why isn't there some existing application that can do this job? is 
> my need too special?
> 

Actually there is at least one:

https://sourceforge.net/projects/mouseposition/

It works here, looks like it just didn't make it into debian.

Have a nice day,

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

No one wants war.
                -- Kirk, "Errand of Mercy", stardate 3201.7

Reply via email to