how could i double a number when clicked on in the graphics window?... this is for graphics.py and a line separating the two sides in the graphics window and on each click on either side it must go up by 2 until 12? i can only think of using a loop?

for i in range(12):
	print i+2
from graphics import *
def tableTennisScorrer():
    w=250
    h=250
    win= Graphwin("table tennis", w, h)
    line = Line(Point(, 250), Point(0, 250))
    line.draw(win)

This should give you an idea how to split the window into three parts. One could add to the left side score, the other to the right side score, and the third is for a click to exit.

#

from graphics import *

def main():
    win = GraphWin("My Score", 120, 100)
    rect_left = Rectangle(Point(0, 0), Point(50,100))
    rect_left.setFill('red')
    rect_left.draw(win)
    rect_right = Rectangle(Point(50, 0), Point(100,100))
    rect_right.setFill('green')
    rect_right.draw(win)
    while True:
        # get the x position of the mouse click
        click_posx = win.getMouse().getX()
        print( click_posx )  # test
        if click_posx < 51:
            print ( "left rect has been clicked")
        elif click_posx < 101:
            print ( "right rect has been clicked")
        else:
            break
    win.close()

main()

This should give you an idea how to split the window into three parts. One could add to the left side score, the other to the right side score, and the third is for a click to exit.

#

from graphics import *

def main():
    win = GraphWin("My Score", 120, 100)
    rect_left = Rectangle(Point(0, 0), Point(50,100))
    rect_left.setFill('red')
    rect_left.draw(win)
    rect_right = Rectangle(Point(50, 0), Point(100,100))
    rect_right.setFill('green')
    rect_right.draw(win)
    while True:
        # get the x position of the mouse click
        click_posx = win.getMouse().getX()
        print( click_posx )  # test
        if click_posx < 51:
            print ( "left rect has been clicked")
        elif click_posx < 101:
            print ( "right rect has been clicked")
        else:
            break
    win.close()

main()

how could i print nunbers on the actual grpahics window?

This question has already been answered. Start a new discussion instead.