The latest version of Python Chess is looking pretty slick!
I found the public domain chess graphics at Wikimedia Commons: http://commons.wikimedia.org/wiki/File:Chess_tile_pd.png. Adding them into Python Chess just required a resize, which Pygame handles very easily with the pygame.transform.scale function. I also added the labels around the board so it is easier to interpret the “move reports” in the scrolling text box on the right. Oh, and I also cleaned up those messages, too.
The other big addition is that I incorporated a little Tkinter, as promised. Before the main pygame window displays, a Tkinter dialog box pops up to get the game parameters — player names and types (human or AI).
In my previous post, I said something about perhaps changing my scrolling text box to something slicker and already implemented. Well, it seems that it is not possible (or at least tricky and not recommended) to use pygame in conjunction with a windows manager because of their conflicting event loops. I googled around and found some ways people can get it to work, but the methods all were dubious looking hacks. There is a window manager project created within pygame called PGU GUI which might be useful for future projects. For now, I’ll content myself with the Tkinter window at the beginning of my program and not worry about changing the scrolling text box.
Incidentally, while looking into Tkinter, I discovered wxPython. There is a comprehensive demo available when you download wxPython which goes through a lot of the possible gui functionality. Looks pretty amazing! There is a lot you can do there. In fact, I think that Python Chess could have been easily done in just wxPython (or Tkinter for that matter) and look just as good as it does using Pygame (Python Chess is not exactly a graphical powerhouse). I guess Tkinter is nice because it is a standard Python library. But Guido van Rossum (the guy who created Python), is quoted on the wxPython website as saying:
wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn’t the standard Python GUI toolkit is that Tkinter was there first.
From what I can tell from the wxPython demo, I think agree! Now I want to use wxPython in a future project….
Here’s Python Chess, version 0.4: PythonChess_v0.4.zip
The only thing remaining to do is add in better AI!