I install pyqtx on lion but still can't find pyqt4

253 views
Skip to first unread message

m li

unread,
Jul 12, 2013, 7:55:38 AM7/12/13
to python_in...@googlegroups.com
As written above.
when I run ipython on my mac(lion) shell like down below
"ipython --gui=qt"
it returned
two errors
1.TerminalIPythonApp] GUI event loop or pylab initialization failed
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Library/Python/2.7/site-packages/ipython-0.13.2-py2.7.egg/IPython/lib/inputhook.pyc in enable_gui(gui, app)

2. 63 # import PyQt4 unconfigured

ImportError: Cannot import PySide or PyQt4

Justin Israel

unread,
Jul 12, 2013, 5:21:33 PM7/12/13
to python_in...@googlegroups.com
If you install packages that are prebuilt, like the PyQtX, then they will go to a specific site-packages location assumed to be the right one. When you build from source, you are building against your specific python which will install them to the same site-packages location. 

This command should be able to tell you where PyQt4 was installed:
mdfind -name "PyQt4" | grep "site-packages"

I am guessing it probably installed it to the standard system python location:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

And possibly installed pyuic4 and pyrcc4 in:
/Library/Frameworks/Python.framework/Versions/2.7/bin

If the site-packages location is not the same as /Library/Python/2.7/site-packages , then you will need to either copy (or symlink) it over to your proper site-packages, or, add that site-packages location to your PYTHONPATH, from your ~/.profile

For instance, on my system I installed PyQt4 through homebrew, so mine lives here:
/usr/local/lib/python2.7/site-packages/PyQt4

I have an entry like this in my ~/.profile
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH





--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



m li

unread,
Jul 14, 2013, 11:29:36 PM7/14/13
to python_in...@googlegroups.com
Hello Justin:
It's very nice of you for giving me those advise. I followed and reinstalled my pyqt by brewhome.
now I can import PyQt4 and have found "pyuic4" and "pyrcc4"
but when I follow the example in the tutorial:

from PyQt4 import QtGui
widget = QtGui.QWidget()
widget.resize(400,300)
widget.show()
widget.raise_()
button = QtGui.QPushButton("Button")
button.show()
button.raise_()
button.deleteLater()
button = QtGui.QPushButton("button",parent=widget)
button.show()
button.raise_()
button.pos()
button.move(30,40)
widget.deleteLater

when I typed in the second line "widget = QtGui.QWidget()" in ipython
it returned me like downbelow:
QWidget: Must construct a QApplication before a QPaintDevice
Abort trap: 6

still I can work it out in mayapython.

As a freshman, I searched the web for solution, there are many suggestion about "QWidget: Must construct a QApplication before a QPaintDevice", but still can't I work it out.
Would you please give me some advise.
thank you

sincerely li
20130715


Justin Israel

unread,
Jul 14, 2013, 11:54:38 PM7/14/13
to python_in...@googlegroups.com
Ok so that just means you probably didn't start ipython via:
$  ipython --gui=qt

That would automatically create a QApplication and start an event loop for you. 



mjearmst...@gmail.com

unread,
Mar 12, 2014, 10:46:19 AM3/12/14
to python_in...@googlegroups.com
I am a windows 7 64 bit user, using Python 2.7.3 and am following the cmivfx tutorial:Pyqt4andMaya

When I enter the code:

from PyQt4 import QtGui
widget = QtGui.QWidget()
widget.resize(400,300)
widget.show()
widget.raise_()

#button = QTGui.QpushButton('Button')
#button.show()
#button.raise_()
button = QtGui.QPushButton('Button', parent = widget)
button.show()
button.move(30, 40)

I also get the error:

QWidget: Must construct a QApplication before a QPaintDevice


As the tut is on a mac, I have noticed a few things that I do not have as a windows user so what am I doing wrong?

I am not using iPython.


Justin Israel

unread,
Mar 12, 2014, 2:44:50 PM3/12/14
to python_in...@googlegroups.com

I'm not sure what you don't have as a windows user... but if you are using a standard python intepreter in a shell to test this, then you must create a QApplication before creating widgets

app = QtGui.QApplication([])

In my tutorials when I use ipython --gui, it will create one for you and start the event loop.
In Maya, a QApplication is also already created.

- justin

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Credible Mulk

unread,
Jul 21, 2014, 10:10:08 AM7/21/14
to python_in...@googlegroups.com
Hi Justin, I have been developing my Python alongside the CMX videos I have purchased (Awesome by the way!) and I am progressing well. I am starting to get to grips with the draw features from some other tutorials, but they can be somewhat sparse on examples. I would like to ask if you could give me a pointer towards the learning that will allow me to create a node based interface using custom or predefined SVG elements. I want to create a system, (unsure of what yet) that will give the end user an interface and ability like that of the following:


I am slightly running before I can walk here, but some reference would be helpful for future developments.

Many thanks and thanks for the work put into the educational videos, they have been excellent value for money. I am still working my way through the rigging ones as well. Plus, using the Beastie Boys as a loading tune was great.

Cheers


--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/L-UdL6sqByM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1cd-zBXee%3DAtf%2Bwzh95AmSkRi5MCB%2BN%2BjG4835F1Tung%40mail.gmail.com.

Justin Israel

unread,
Jul 21, 2014, 3:37:34 PM7/21/14
to python_in...@googlegroups.com

Hey there,

Have you come across this yet from an earlier post?
http://vimeo.com/40380911

Tim Withers did a node based interface in Qt to control particle sims. I had helped him along with it as part of his masters thesis. It uses svg for the node graphics. And he posted the source here:
https://github.com/drumboy354/MayaNodeInterface

Getting into QGraphics is probably the second hardest part of Qt,  next to the model/view system. But it has a lot of concepts you probably already know like the transforms and scene graph. The painting and parent child bounds stuff can be a little tricky though. Eventually it clicks though and ends up being pretty fast.

Credible Mulk

unread,
Jul 22, 2014, 3:04:27 AM7/22/14
to python_in...@googlegroups.com
Thanks very much for this Justin, I had seen the Tim Withers demo, which was excellent. In fact, I saw a friend of mine had posted on there when he was getting to grips with this process, so I am playing catch up to try and get up to speed. The link to the github repo is very welcome and I expect to be digesting it (slowly) at some point, though I may save it until I have a better grasp of pythons drawing abilities.  Currently, I am using Python to resolve tool requirements for two or three apps, but the studio uses 3ds Max , which Autodesk is trying to implement Python with, but the studio is using Blur Python, which has some odd issues and is largely unsupported. Much preferable to work with Python and Maya as they seem well seated together, so the development I am doing is taking place before work, in lunch hours and spare hours at home. I am confident I will get there, as mentioned, the cmiVFX videos have been an enormous help and feedback like this from artists such as yourself is also very much appreciated.

Thanks again and good luck in future work, I look forward to seeing what new stuff is coming from the site and yourself.




Reply all
Reply to author
Forward
0 new messages