[Tutor] A range of numbers
Leung Cris
krazie_mu_boi at hotmail.com
Mon Dec 1 19:11:15 EST 2003
Thx, but while you are at it, can you tell me what is wrong with this code?
>>>while 1:
>>> (x,y) = mouse_position()
>>> if 200 <= x <= 300 and 200 <= y <= 300 and mouse_buttons()['left'] == 1:
>>> break
>>> move(300,200)
>>> text('You Did it!')
Whever I try it, it says Unpack Sequence (or something like that ) . I knew this was because my mouse wasn't in the graphic window, meaning that mouse_position() = None ; so, i moved my mouse to the graphic window, and try the code again: FREEZES.
>From: Gregor Lingl <glingl at aon.at>
>To: Leung Cris <krazie_mu_boi at hotmail.com>
>Subject: Re: [Tutor] A range of numbers
>Date: Tue, 02 Dec 2003 00:56:56 +0100
>
>
>Another way to do it would be:
>
>x,y = mouse_position()
>if 100 <= x <= 200 and 100 <= y <= 200 and ... :
>do something
>
>Gregor
>
>
>Leung Cris schrieb:
>
> > I was wondering if it is possible to set a variable or something to a
> > RANGE of numbers. For instance , I want to have it so that when I
> > mouse clicks in a certain region( let say, from (100,100) to
> > (200,200)), it prints out "You Clicked!" . I'm doing this with
> > Livewires right now. Of course, it would take forever if i try to write:
> >
> > if mouse_position() == (100,100) or (100,101) or (100,102)
> > ..............................
> > and mouse_buttons()['left'] == 1:
> > do something
> >
> > that won't work... so , can anyone help?
> >
> > _________________________________________________________________
> > MSN ¬Ûï´£¨Ñ±z³Ì²³æªº¤è¦¡¤À¨É¨Ã¦C¦L±zªº¬Û¤ù¡A½Ð²¾¦Ü :
> > http://photos.msn.com.hk/support/worldwide.aspx
> >
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
>
_________________________________________________________________
¦b±zªº¦æ°Ê¸Ë¸m¤W¶Ç°e±µ¦¬ Hotmail ¶l¥ó¡A½Ð²¾¦Ü: http://zh-asiasms.mobile.msn.com
More information about the Tutor
mailing list