You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hlab, lab-197 edited this page Nov 13, 2012
·
1 revision
GUI Tips
qt4reactor:
Whenever using twisted (i.e. LabRAD) with PyQt4, qt4reactor.py must be instantiated before twisted. Even 'import LabRAD' must come after qt4reactor. Doing otherwise will result in a "reactor already installed" error.
If integrating PyQt4 with a LabRAD server, make sure to instantiate qt4reactor before importing the server:
fromPyQt4importQtGuia=QtGui.QApplication( [] )
importqt4reactorqt4reactor.install()
fromlabrad.serverimportLabradServer, setting, Signal
Special note: if your LabRAD server inherits from a parent LabRAD server, make sure you import QtGui in the parent server as well!
fromPyQt4importQtGui
Misc: When creating a new window, if the window opens and immediately closes, this is because the window might be assigned to a temporary variable which is deleted as soon as the function finishes. Ex:
defcreateWindow(self)
newWindow=NewWindow(self)
This window will close. If the new window is instantiated as an object of the parent class, then the window will persist.