Hi,
A QApplication must exist before any QWidget is created.
If you are using ipython to test out PyQt functionality, make sure you are
starting ipython like this:
ipython --gui=qt
As mentioned in my video, this will automatically create your QApplication and
start the event loop, so you are free to create widgets right when the
interpreter is finished starting up.
If you are running ipython (or just python) without any arguments, then you
must do the traditional approach just like any pyqt script:
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication([])
Note, this approach tends to give me terrible hang ups with input to an
interactive terminal, which is why I highly recommend ipython --gui=qt for an
interactive test session.
-- justin
~ BTW, my name is actually Justin.... Justine would be a girls name ;-) ~
On Nov 30, 2012, at 10:49 PM, san wrote:
> Hello Justine when i try to create object
>
> widget = QGui.QWidget()
>
> i get thrown out of interpreter saying
> QWidget: Must construct a QApplication before a QPaintDevice
>
> where as in your first video lecture u didnt got any such error?
>
> In [1]: from PyQt4 import QtGui
>
> In [2]: widget = QtGui.QWidget()
> QWidget: Must construct a QApplication before a QPaintDevice
>
> D:\Console>
>
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe