Hello, and sorry to re-ask my question, but I really need a working GUI to display my OpenGL.<br><br>I think I have read everything on the web about closing pyQT. Some people say you can't call QApplication twice, but don't give an alternative solution. Others give code snippets with app.exec_loop() and not app.exec_(). Some others use a connection :<br>
<pre class="lang-rb prettyprint">connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))<br></pre>This doesn't work either.<br><br>I would have switched to someting else, but GLUT or ToGL (Tkinter) are not very good solutions, wxPython is not compilable for 64 bit under macports, GTKglext is not working well with macports, GTK apputils is deprecated ... So I am stuck here : how to create a basic OpenGL window under Linux and Mac OS X, which can be closed/reopened without crashing and make the main GTK app quit ...<br>
<br>Thank you in advance !<br><br>Michka<br><br><div class="gmail_quote">2011/4/19 Michka Popoff <span dir="ltr"><<a href="mailto:michkapopoff@gmail.com">michkapopoff@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello<br><br>I need some help to implement a QT Window to draw some OpenGL in an python-GTK2 application.<br>In the GTK application, I have a push button which will launch an OpenGL scenery (In a QT window). I should be able to close the OpenGL Window and to reopen it as many times as I want, without exiting the GTK application.<br>
<br>I used the code found here : <a href="http://www.siafoo.net/snippet/316" target="_blank">http://www.siafoo.net/snippet/316</a> , but rewritten for my app (as I call main() from the GTK part) :<br><br>def main():<br> app = QtGui.QApplication(['Spiral Widget Demo'])<br>
window = SpiralWidgetDemo()<br> window.show()<br> app.exec_()<br><br><br>My code works perfectly under Mac OS X with python 2.7 and the pyQT port from macports. But under Ubuntu 10.10 with python 2.6.6 I get a segmentation fault if I try to reopen the window.<br>
<br>What I do :<br><br>- Open OpenGL Window (QT)<br>- Close it with the X<br>- Reopen it<br>- SegFault here<br><br>Why is there a difference between the OS X and ubuntu packages ? I have a backtrace (made with dgb) of the segfault. It seems that the memory is not cleared when I close the window. I don't want to use sys.exit because it will also close my GTK app.<br>
<br><br>#0 0x0000000000497d72 in ?? ()<br>#1 0x0000000000499642 in PyErr_WarnEx ()<br>#2 0x00007ffff536d274 in ?? ()<br> from /usr/lib/pymodules/python2.6/gtk-2.0/gobject/_gobject.so<br>#3 0x00007ffff5a0bb89 in g_logv () from /lib/libglib-2.0.so.0<br>
#4 0x00007ffff5a0bfa3 in g_log () from /lib/libglib-2.0.so.0<br>#5 0x00007fffe1cde39e in ?? () from /usr/lib/libQtGui.so.4<br>#6 0x00007fffe1cdf06e in ?? () from /usr/lib/libQtGui.so.4<br>#7 0x00007fffe1ce4036 in ?? () from /usr/lib/libQtGui.so.4<br>
#8 0x00007fffe1cc78ee in QGtkStyle::QGtkStyle() () from /usr/lib/libQtGui.so.4<br>#9 0x00007fffe1c4dda3 in QStyleFactory::create(QString const&) ()<br> from /usr/lib/libQtGui.so.4<br>#10 0x00007fffe193cfa7 in QApplication::style() () from /usr/lib/libQtGui.so.4<br>
#11 0x00007fffe1945be5 in QApplicationPrivate::initialize() ()<br> from /usr/lib/libQtGui.so.4<br>#12 0x00007fffe1945d01 in QApplicationPrivate::construct(_XDisplay*, unsigned long, unsigned long) () from /usr/lib/libQtGui.so.4<br>
#13 0x00007fffe1946d91 in QApplication::QApplication(int&, char**, int) ()<br> from /usr/lib/libQtGui.so.4<br>#14 0x00007fffe291f654 in ?? ()<br> from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so<br>#15 0x00007fffe291f73d in ?? ()<br>
from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so<br><br>Thank you in advance if somebody has any explanation why this happens and how to close the window properly and free up memory/threads which are perhaps still open.<br>
<font color="#888888">
<br><br>Michka<br><br><br>
</font></blockquote></div><br>