sciapp / python-gr

Python wrapper for the GR framework
https://gr-framework.org
Other
30 stars 8 forks source link

GKS: Wx support not compiled in #20

Open rjsdotorg opened 4 years ago

rjsdotorg commented 4 years ago

I just installed gr 1.13.0 via pip install gr with Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32

Also, in https://github.com/sciapp/python-gr/blob/master/examples/wx_ex.py I had to change for Python 3.8 map() z = map(lambda x: x & 0xff, d) to z = list(map(lambda x: x & 0xff, d)) as init expects a list, and the first call to z on line 73 empties the generator.

I now just get GKS: Wx support not compiled in So, how to go about the wx build?

Our goal is to start a drop-in replacement for wx.lib.plot(), which is terribly slow for samples>~100k

FlorianRhiem commented 4 years ago

Hello, sorry for the delayed reply.

wxWidgets support is built in on some platforms, but not currently in the Windows builds, Qt is the only GUI framework with support included in GR there. You can build GR yourself, either by cross compiling or by using cmake, but you will have to provide the wxWidgets libraries and headers, and set up the compilation of wxplugin yourself there.

What I would recommend instead is to use the memory output from GR to create a 32-bit RGBA image in memory, create a wxImage from that and display the image (possibly by converting it to a wxBitmap first and then calling wxDC::drawBitmap). That way you will not need wxWidgets support in GR and it should still be quite fast. To get memory output, you have to use gr_beginprint() with a string containing the desired resolution and a pointer to memory. For more information, see the memory output documentation.