Using Python Gtk Gui Front End With C++ Backend
I have some C++ code and am now building a GUI for an application. In the past I've used python and pygtk for GUI programming and occasionally link to some C++ code to do some heav
Solution 1:
If you have a drawing area, you can do this:
#include<gdk/gdkx.h>
GtkWidget *drawing_area;
GdkWindow *window;
Window xid;
if (gtk_widget_get_realized (drawing_area)) {
window = gtk_widget_get_window (drawing_area);
xid = gdk_x11_window_get_xid (window);
}
Then you can pass the xid to whatever you want.
Note that widgets only get their windows created when they are realized. So, don't do the above before the drawing area's "realize" signal has been emitted.
You'll need to make the drawing area from the Python code available to the C++ code. I don't know the internals of pygtk that well, so that's up to you :)
Post a Comment for "Using Python Gtk Gui Front End With C++ Backend"