so im returning two inputs and want to use them within another function, when i run the code, it says the function im returning the code from is not defined. any idea what the problem may be?
Chessboard Class:
class ChessBoard(tk.Frame):
def __init__(self, parent, rows=8, columns=8, size=70, color1="white", color2="lightgrey"):
self.rows = rows
self.columns = columns
self.size = size
self.color1 = color1
self.color2 = color2
self.pieces = {}
The function that is returning two inputs:
def UserInput(self): #Tester Function
count = 0
while count < 2:
KingRow = int(input("Choose Row: ")) #mighht not be needed
KingColumn = int(input("Choose Column: ")) #choose the column
return KingRow, KingColumn
count = count + 1
The function i would like to use it within:
def KingMoves(self, rows, columns):
FinalMove = []
c = ChessBoard(parent)
KingRow, KingColumn = c.UserInput()
FinalMove.append(((KingRow - 1),(KingColumn)))
FinalMove.append(((KingRow + 1),(KingColumn)))
FinalMove.append(((KingRow),(KingColumn + 1)))
FinalMove.append(((KingRow + 1),(KingColumn + 1)))
FinalMove.append(((KingRow - 1),(KingColumn + 1)))
FinalMove.append(((KingRow + 1),(KingColumn - 1)))
FinalMove.append(((KingRow - 1),(KingColumn - 1)))
return FinalMove;
Current Error:
name 'UserInput' is not defined