About me I've been a computer programmer since I first started typing in program listings on a Commodore Vic 20 when I was about 8. My hobbies include electronics, CNC manufacturing, photography, beer and winemaking.
I live with my wife and lots of left-over parts from unfinished projects in Lincoln, Nebraska, USA.]
Blog
29 April 2006, 21:58 UTC in softwareOnscreen Crosshairs in tcl/tk
I was staring too long at a screenshot of a graph on some web page, wishing I
could tell if two things lined up. Well, inspiration struck, and this program
was born. Two windows—one that is one pixel wide, and another
that is one pixel tall—are created, and they follow the mouse
around every 1/10 second or so. They're displaced by one pixel so that clicking will hit the underlying window, not the crosshair.
I apologize for the changing colors, since xor isn't available with this simple
method of drawing the lines, it's the only way to be sure to get contrast. I considered making the color depend on e.g., whether SHIFT is pressed, but if Tk provides this information to a window that doesn't have focus, I overlooked it in the manpages.
Onscreen Crosshairs in tcl/tk
I was staring too long at a screenshot of a graph on some web page, wishing I could tell if two things lined up. Well, inspiration struck, and this program was born. Two windows—one that is one pixel wide, and another that is one pixel tall—are created, and they follow the mouse around every 1/10 second or so. They're displaced by one pixel so that clicking will hit the underlying window, not the crosshair.
I apologize for the changing colors, since xor isn't available with this simple method of drawing the lines, it's the only way to be sure to get contrast. I considered making the color depend on e.g., whether SHIFT is pressed, but if Tk provides this information to a window that doesn't have focus, I overlooked it in the manpages.
All older entries
Website Copyright © 2004-2024 Jeff Epler