I am making a poker game using pyGTK. My problem right now is that the other players won't let me play! Each player has a function for betting and they go in order such as amandaBet(), playerBet(), billBet()... where player is you. Since this is a GUI game, I am not using the terminal for input and am relying on Button widgets for the player to call, raise and fold. In my text version, this wasn't a problem because everything gets put on hold while waiting for raw_input. How can I make my playerBet() function wait for input from one of these buttons and not just check their status and move on to the next player?

Anyone?

Member Avatar for masterofpuppets

Hi
I havent really used pyGTK but I'll try to help anyway
I kinda did something similar to what you're trying to do but for a blackjack game If you have buttons like Fold, call, rise... why don't you just set the command to these buttons to be a separate function which you call, after having completed your turn. This finction then calls the other functions for the players. That way the fns for the other players will have to wait untill you make your move
I thinks it seems confusing so I'll try to code it a little:

def amandaBet():
####
...

def billBet():
###
...
. so on..

def playerBet():
#your code here...
#do stuff
...
betInOrder() # here you could either start from the beginning, i.e. the first to bet by calling betInOrder() when you press Fold, Call etc. or do something else. That way the game will not continue untill you call betInOrder()

def betInOrder():
amandaBet()
billBet()
...
playerBet()

I don't know if this is any helpful but I used something similar

That makes sense. I'll give it a try. Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.