I am trying to dynamically create entry widgets for a poker game such that players can place their bets for the round. I have a button created to start the betting which is shown below.
betButton = tkinter.Button(root, text = "Bets for the round", command= lambda:[trackMoney(), betButton.destroy()])
betButton.pack()
And here is the trackMoney method
def trackMoney():
'''Counts the money in the pot and the money for each player'''
global currentBet, currentBets, hasRaised, entry
currentBet = 0
currentBets = []
hasRaised = []
hasRaised.append(False in range(len(cards)))
has_folded.append(False in range(len(cards)))
print(len(cards))
print(len(has_folded))
currentBets.append(0 for i in range(len(cards)))
for i in range(len(cards)):
if has_folded[i]:
continue
else:
if not hasRaised[i]:
entry = Entry(root, textvariable= "Do you choose to raise, check, or fold?")
entry.pack()
if entry.get() == "Raise":
entry.selection_clear()
entry.config(textvariable= "How much do you want to raise by?")
currentBet = int(entry.get())
hasRaised[i] = True
money[i] = money[i] - (currentBet - currentBets[i])
currentBets[i] = currentBet
elif entry.get() == "Check":
entry.selection_clear()
money[i] = money[i] - (currentBet - currentBets[i])
currentBets[i] = currentBet
elif entry.get() == "Fold":
entry.selection_clear()
has_folded[i] = True
else:
if entry.get() == "Check":
entry.selection_clear()
money[i] = money[i] - (currentBet - currentBets[i])
currentBets[i] = currentBet
elif entry.get() == "Fold":
entry.selection_clear()
has_folded[i] = True
for index in range(len(image_listHand)):
button_list[index].config(text = getPlayerMoney(index))
Whenever I press the button however, none of the entries show up. I was thinking about making them come up on a pop up window. Is there any way for me to fix this?