Creating GUI widgets OOT using C++


I’m currently attempting to create an OOT WX widget. And I’m facing
some issue with SWIG (I think).

The “make” method looks like this :

wx::sptr wx::make(wxWindow* parent)

And the GRC .xml gives as the first argument the ‘top_level’ (like in
other wx elements), which is of the type :

<grc_gnuradio.wxgui.panel.Panel; proxy of <Swig Object of type
‘wxPanel *’ at 0x3ab9440> >

and wxPanel is indeed a subclass of wxWindow, however I get :

Traceback (most recent call last):
File “./”, line 55, in
tb = top_block()
File “./”, line 32, in init
self.guitest_wx_0 = guitest.wx(self.GetWin())
line 111, in make
return _guitest_swig.wx_make(*args, **kwargs)
TypeError: in method ‘wx_make’, argument 1 of type ‘wxWindow *’

So my guess is that SWIG somehow needs to know where/what/how about
the wx vs wxPython relation ship … but I have no idea how.
Everything I tried so far resulted in a bunch of errors.
For examples, trying to %import the “window.i” from
/usr/include/wx-2.8/wx/i_files/ results in a bunch of errors like :

/usr/share/swig/2.0.9/std/std_vector.i:87: Error: Can’t copy typemap
(directorout) std::vector< size_t,std::allocator< size_t > > =
std::vector< size_t,std::allocator< size_t > > &DIRECTOROUT

So has anyone ever done something like this ?

Even if I manage to create it, the next issue I face is the threading
model. I’m playing with OpenGL and OpenCL and essentially everything
needs to run from one single thread (which ever was used to create the
GL context), and I’m not really sure how to ensure that as a wx


 Sylvain M.

PS: I’ll also need to do the same for Qt as well a bit later so if you
have any example of that, feel free to share. Although given it’s
already C++ in the base widgets, I hope it’ll be easier. The threading
issue will be the same though, so if you have info on that, please

So after continuing to bang my head against a wall for WX, I decided
to try my luck at Qt.

That mostly works better.

However I tried having my class inherit both from gr_sync block and
from QWidget and that doesn’t seem to work too well.
It seems that my destructor gets called :

Breakpoint 2, 0x00007fffe07e17c0 in gr::guitest::qt_impl::~qt_impl() ()
from /opt/gnuradio-3.7/lib64/
(gdb) bt
#0 0x00007fffe07e17c0 in gr::guitest::qt_impl::~qt_impl() ()
from /opt/gnuradio-3.7/lib64/
#1 0x00007fffec017332 in ?? () from
#2 0x00007ffff51866fb in ?? () from
#3 0x00007ffff518a077 in ?? () from
#4 0x00007ffff518af73 in ?? () from
#5 0x00007ffff7afa1ce in PyEval_EvalFrameEx () from
#6 0x00007ffff7afb955 in PyEval_EvalCodeEx () from
#7 0x00007ffff7a8724c in ?? () from /usr/lib64/
#8 0x00007ffff7a61413 in PyObject_Call () from
#9 0x00007ffff7a7020f in ?? () from /usr/lib64/
#10 0x00007ffff7a61413 in PyObject_Call () from
#11 0x00007ffff7ab7d86 in ?? () from /usr/lib64/
#12 0x00007ffff7ab79e8 in ?? () from /usr/lib64/
#13 0x00007ffff7a61413 in PyObject_Call () from
#14 0x00007ffff7af8c4a in PyEval_EvalFrameEx () from
#15 0x00007ffff7afb955 in PyEval_EvalCodeEx () from
#16 0x00007ffff7afba82 in PyEval_EvalCode () from
#17 0x00007ffff7b15d1c in ?? () from /usr/lib64/
#18 0x00007ffff7b16b80 in PyRun_FileExFlags () from
#19 0x00007ffff7b1760d in PyRun_SimpleFileExFlags () from
#20 0x00007ffff7b290ab in Py_Main () from /usr/lib64/
#21 0x00007ffff747460d in __libc_start_main () from /lib64/
#22 0x000000000040091d in _start ()

But I don’t know why !?! …

Is there really no other way than to have a distinct GUI widget class
and gr_sync block class and forward everything from one to the other ?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs