S
Shawn Minisall
I'm just trying to test and see if the get mouse statements are working
in my program. If they are, in the console window, it should go back to
the prompt. It doesn't for all of them, just the last
rectangle...sometimes. Am I setting them up correctly? here's the
relevant code...thx
The first two numbers are x1,x2 and the last two are y1, y2.
rectMathButton = CreateRect(4,6,7,8,"grey")
rectMathButton.draw(win)
rectScienceButton = CreateRect(3.5,6.5,5,6,"grey")
rectScienceButton.draw(win)
rectHistoryButton = CreateRect(3.5,6.5,3,4,"grey")
rectHistoryButton.draw(win)
rectGeographyButton = CreateRect(3.1,7,1,2,"grey")
rectGeographyButton.draw(win)
#math
p1 = win.getMouse()
while p1.getX()> 6 or p1.getX()< 4 or p1.getY()> 8 or p1.getY()< 7:
p1 = win.getMouse()
#science
p2 = win.getMouse()
while p2.getX()> 6.5 or p2.getX()< 3.5 or p2.getY()> 6 or p2.getY()<
5:
p2 = win.getMouse()
#history
p3 = win.getMouse()
while p3.getX()> 6.5 or p3.getX()< 3.5 or p3.getY()> 4 or p3.getY()<
3:
p3 = win.getMouse()
#geography
p4 = win.getMouse()
while p4.getX()> 7 or p4.getX()< 3.1 or p4.getY()> 2 or p4.getY()<
1.1:
p4 = win.getMouse()
in my program. If they are, in the console window, it should go back to
the prompt. It doesn't for all of them, just the last
rectangle...sometimes. Am I setting them up correctly? here's the
relevant code...thx
The first two numbers are x1,x2 and the last two are y1, y2.
rectMathButton = CreateRect(4,6,7,8,"grey")
rectMathButton.draw(win)
rectScienceButton = CreateRect(3.5,6.5,5,6,"grey")
rectScienceButton.draw(win)
rectHistoryButton = CreateRect(3.5,6.5,3,4,"grey")
rectHistoryButton.draw(win)
rectGeographyButton = CreateRect(3.1,7,1,2,"grey")
rectGeographyButton.draw(win)
#math
p1 = win.getMouse()
while p1.getX()> 6 or p1.getX()< 4 or p1.getY()> 8 or p1.getY()< 7:
p1 = win.getMouse()
#science
p2 = win.getMouse()
while p2.getX()> 6.5 or p2.getX()< 3.5 or p2.getY()> 6 or p2.getY()<
5:
p2 = win.getMouse()
#history
p3 = win.getMouse()
while p3.getX()> 6.5 or p3.getX()< 3.5 or p3.getY()> 4 or p3.getY()<
3:
p3 = win.getMouse()
#geography
p4 = win.getMouse()
while p4.getX()> 7 or p4.getX()< 3.1 or p4.getY()> 2 or p4.getY()<
1.1:
p4 = win.getMouse()