##// END OF EJS Templates
Added a Qt4 simple example to test %gui functionality....
Added a Qt4 simple example to test %gui functionality. This is put in examples/ and not as a test because it requires manual interaction and opens windows, but this way we can test it at least manually during development. Next we'll add similar ones for the other toolkits.

File last commit:

r2211:b18f4aa3
r2211:b18f4aa3
Show More
gui-qt.py
37 lines | 885 B | text/x-python | PythonLexer
#!/usr/bin/env python
"""Simple Qt4 example to manually test event loop integration.
This is meant to run tests manually in ipython as:
In [5]: %gui qt
In [6]: %run gui-qt.py
Ref: Modified from http://zetcode.com/tutorials/pyqt4/firstprograms/
"""
import sys
from PyQt4 import QtGui, QtCore
class SimpleWindow(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 200, 80)
self.setWindowTitle('Hello World')
quit = QtGui.QPushButton('Close', self)
quit.setGeometry(10, 10, 60, 35)
self.connect(quit, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('close()'))
if __name__ == '__main__':
app = QtCore.QCoreApplication.instance()
if app is None:
app = QtGui.QApplication([])
sw = SimpleWindow()
sw.show()
app.exec_()