Re: [Tutor] A range of numbers

Magnus Lycka magnus at thinkware.se
Wed Dec 3 14:02:38 EST 2003


> Ya, that's true.... but even if i change it something like this:
> >>def func():
> >>         begin_graphics()
> >>         box(200,200,300,300)
> >>         begin_mouse()
> >>         while 1:
> >>                 
> >>                 try:
> >>                         x,y = mouse_position()
> >>                 except:
> >>                         x,y = 0,0
> >>                 if 200 <= x <= 300 and 200 <= y <= 300 and mouse_buttons()['left'] == 1:
> >>                         break                        
> >>         end_mouse()
> >>         box(300,200,500,500)
> 
> It sill won't work. I've also tried putting time.sleep(0.05) before the while loop ends , but it ....still freezes.

Danny Yoo already explained why that won't work.
And don't forget to be more specific about catching
exceptions, or you will catch other errors than you
thought you did, and that will often make debugging
very hard.

In general you can find out a lot about your code
by putting print statements here and there. A
"print x,y" in the end of the while loop would
probably give you a clue. By the way--the program
isn't frozen, it's rather running hot!


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus at thinkware.se



More information about the Tutor mailing list