[Tutor] Testing for mouse clicks
Phil
phillor9 at gmail.com
Sat Nov 7 18:41:44 EST 2020
Spurred on by success with my recent project involving a grid of lists,
I now have another grid project in mind. If I want to test whether the
mouse is over, say one of six window locations, I would do something
like the following to test the mouse coordinates:
if 136 <= x <= 156 and 370 <= y <= 390:
do_something
elif 186 <= x <= 206 and 370 <= y <= 390:
do_something
elif 236 <= x <= 256 and 370 <= y <= 390:
do_something
elif etc
Now, if I have a 15 * 15 grid of window locations that I want to test
then repeating the above 225 times becomes a bit untidy, and tedious.
How might I best attack this mouse_testing problem?
--
Regards,
Phil
More information about the Tutor
mailing list