[Tutor] a logic problem in an if statement

Bill Allen wallenpb at gmail.com
Sun Sep 26 22:36:56 CEST 2010


On Sun, Sep 26, 2010 at 3:12 PM, Marc Tompkins <marc.tompkins at gmail.com>wrote:

> On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen <wallenpb at gmail.com> wrote:
>
>>
>> Any thoughts how I am going wrong here?
>>
>> Looks like you've got two different names for the first mouse click...
>
>         mouse_pos1 = mouse_pos
>>
>
> but
>
> if mouse_pos[1] < height/2 and mouse_pos2[1] > height/2:
>>
>
>
> Bingo!  Yes, that's the problem.  Should have  been if mouse_pos1[1] <
height/2 and mouse_pos2[1] > height/2:  rather than if mouse_pos[1] <
height/2 and mouse_pos2[1] > height/2:

That was basically a typo to which I had become completely blind.  I did it
in the second case as well, but it did not affect the result in that case,
making it even harder for me to spot.

I hate it when I do something like that!    A combination of poor choice of
names for the variables and programming tunnel vision....

Many thanks,
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100926/e2a4c3e3/attachment-0001.html>


More information about the Tutor mailing list