Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
On Sun, Sep 26, 2010 at 5:12 PM, Steven D'Aprano wrote: > On Mon, 27 Sep 2010 06:01:35 am Bill Allen wrote: > > Now your decision logic becomes simple, and obvious. It documents > itself: > > if click_in_bottom_half1 and click_in_bottom_half2: >print "Both clicks in bottom half of screen" > el

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Steven D'Aprano
On Mon, 27 Sep 2010 06:01:35 am Bill Allen wrote: > #This captures the coordinates the two mouse clicks, successfully. > mouse_pos is in the form (x,y), such as (204,102). > if mouse_pressed == (1,0,0) and first_click == False: > first_click = True > mouse_pos1 = mouse_pos > elif m

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:36 PM, Bill Allen wrote: > I hate it when I do something like that!A combination of poor choice of > names for the variables and programming tunnel vision > Been there, done that! -- www.fsrtechnologies.com ___ Tutor

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
On Sun, Sep 26, 2010 at 3:12 PM, Marc Tompkins wrote: > On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen 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]

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen 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: > -- www.fsrtechnologies.

[Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
Ok, I am have a problem with some logic in a piece of code I am working on. I have tinkered with it for hours and am stumped. Pretty sure I have lost sight of the forest for the trees... The purpose of this code is to take the coordinates on screen of the mouse at the time of two mouse clicks,