I'm makin Tic Tac Toe game and I have already search for how to get 2 positions with onclick() of Python Turtle. The thing I got is just on this link : Python 3.0 using turtle.onclick. I want to get 2 positions but I have a problem with "turtle.mainloop()" My Solution is:
def getPosX(x_X, y_X):
print("(", x_X, ",", y_X,")")
def getPosO(x_O, y_O):
print("(", x_O, ",", y_O,")"
def choiceX():
Xplay = turtle.getscreen()
Xplay.onclick(getPosX)
turtle.mainloop()
return Xplay
def choiceO():
Oplay = turtle.getscreen()
Oplay.onclick(getPosO)
turtle.mainloop()
return Oplay
What I got just like it just takes the postion of Xplay.onclick().
And I also try to delete the " turtle.mainloop()" of each def to use the for loop in another def:
def play():
for i in range(3):
choiceX()
choiceO()
return i
and it doesn't work. I think I need the better measure Thanks