How to wait for a click?

Bill Mill llimllib at f2o.org
Tue Apr 8 02:56:36 EDT 2003


Hello,
I am making a Go game in wxPython. I completed the GUI with few 
problems; originally it only allowed human players, the graphical
board was tied directly to the logical board, so the click handler
passed the move directly to my class representing a Go board. All 
was well. However, I am now trying to adopt a more elegant structure.

In the new structure, a referee class calls the genmove() function 
of a HumanGoPlayer class and expects as a return value a move. Herein
lies the problem; how do I have genmove() (which has a reference to 
the board) wait for a click and return the move? I know I could have
it check some variable in the board class every x milliseconds, but
that's very inelegant. Is there a better way? Am I thinking about the 
problem wrong?

Thanks
Bill Mill
llimllib at f2o.org
Peace.




More information about the Python-list mailing list