Chess GUI with wxPython Phoenix

Boštjan Mejak <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <CAFNeOzvk-C5DEQ-qz-F=BJr4Q+L52OZBE-7HnbSt7J9x5PUftA@mail.gmail.com>
I am creating a chess GUI with wxPython Phoenix
(wxPython-4.0.0rc1.dev3436+efbe850,
the latest wheel build as of 10/16/2017 for Python 3.6 on Windows 10
64-bit).


My backend is going to be python-chess, a lovely chess library with all the
bells and whistles, like legal move detection and all that stuff.


And now to the question. How on Earth can I incorporate a chess board onto
the panel of my main window? python-chess provides a way to display the
chess board, even in SVG, but I can't seem to do this. I've looked many
solutions, and the one I come up with is by using the
wx.AutoBufferedPaintDC. That'll create sort sort of a canvas on the panel
for me to paint the chess board to. Also, the chess board itself is static,
but the pieces must be interactive. I just can't make this work.


Do I need to create a custom wx.Panel class or something else? Also, I must
make sure that wx.Window.SetBackgroundStyle is called with
wx.BG_STYLE_PAINT somewhere in the class initialization code to avoid
flickering when a chess piece moves. Further, this wx.DC derivative can be
used inside of an EVT_PAINT() event handler to achieve double-buffered
drawing. How can this be coded?

I just don't have enough knowledge to do this. Does anyone know how can I
do this? Some code examples would be nice, because that'll give me a
clearer picture on the task at hand.

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.