Re: Re: Chess GUI with wxPython Phoenix
Chris Barker <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <CALGmxEKsCTD0Lc9QSvZU_FqK3_92tprcW2w7QOZe_FyxS+0Wxw@mail.gmail.com> |
On Thu, Oct 26, 2017 at 11:35 AM, <[email protected]> wrote: > Well, this is all well and good, but I want to display the SVG image on > the panel, not a PNG image or an image of some other format. Sadly, > wxWidgets doesn't support SVG format and therefore wxPython doesn't support > SVG. We're in late 2017 and wxWidgets/wxPython don't support SVG format? > That's like a real bummer! > I suppose, but SVG is a vector graphic format -- to fully support it you need to write a LOT of code. Which folks have worked on, though I don't think any of those efforts are complete. > Anyway, I'm using python-chess library which outputs SVGs, it outputs the > chessboard with all the pieces at their initial position, all as an SVG > image. The python-chess library has these neat functions to make a move, > like chess.Board().push_san("e4") moves the pawn from the e2 square to the > e4 square. Simple as cake! > well, then you pretty much have your program :-) I was playing with this python-chess library and IPython in a Jupyter > Notebook and everything looked so dandy. So you tell me how exactly can I > render this chessboard in > SVG format on a wx.Panel. > Your best bet is probably to do what Jupiter is doing -- i.e. rendering with a browser. You can embed the system browser in a wxPython app: https://wxpython.org/Phoenix/docs/html/wx.html2.WebView.html Or the Chrome embedded framework: https://github.com/cztomczak/cefpython Another option is to use an external SVG renderer, like Inkscape, and have it render PNGS, and then load those up in wx. Really kludgy but with modern fast computers, probably good enough! -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] -- 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.