計算でクリック イベントの値を使用しようとしています。int に変換しようとすると、次のエラーがスローされます。
TypeError: unsupported operand type(s) for -: 'int' and 'main'
これは、エラーを取得するコードの一部です
def goto(self, event):
self.ex = int(event.x)
self.ey = int(event.y)
self.find_distance(self.ex, self.ey)
def find_distance(xclick, yclick, self):
#distance formula = sqrt((x2 - x1)^2 + (y2 - y1)^2)
self.xadd = (xPos - xclick)^2
self.yadd = (yPos - yclick)^2
self.step2 = self.xadd + self.yadd
print sqrt(step2)