Hello, so I've been working on a simple Tic Tac Toe game using TKinter graphics GUI. However i keep getting this error, and i'm not sure why. Any help would be greatly appreciated.
Heres the code
import graphics import random def constructBoard(): win=graphics.GraphWin("Tic Tac Toe",500,500) win.setCoords(0.0,0.0,3.0,3.0) line1=graphics.Line(graphics.Point(1,0), graphics.Point(1,3)).draw(win) line2=graphics.Line(graphics.Point(2,0), graphics.Point(2,3)).draw(win) line3=graphics.Line(graphics.Point(0,1), graphics.Point(3,1)).draw(win) line4=graphics.Line(graphics.Point(0,2), graphics.Point(3,2)).draw(win) def player1Move(win): mouseClick = win.getMouse() x=mouseClick.getX() y=mouesClick.getX() radius = random.randint(5, 20) topL = graphics.Point(x-radius, y-radius) botR = graphics.Point(x+radius, y+radius) player1X = graphics.Line(graphics.Point(topL, topL), graphics.Point(botR, botR)) player1X.draw(win) def player2Move(win): mouseClick = win.getMouse() x = mouseClick.getX() y = mouseClick.getX() radius = random.randint(5,20) topL = graphics.Point(x-radius, y-radius) botR = graphics.Point(x+radius, y+radius) player2Circle = graphics.Circle(topL, botR) player2Circle.draw(win) def main(): win = constructBoard() player1Win = False player2Win = False while player1Win == False and player2Win == False: player1Move(win) player2Move(win)
Heres the error
Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> main() File "C:/Python25/TicTacToe.py", line 43, in main player1Move(win) File "C:/Python25/TicTacToe.py", line 17, in player1Move mouseClick = win.getMouse() AttributeError: 'NoneType' object has no attribute 'getMouse'
again any help would be greatly appreciated, thanks!