This is a month old post, but I'll reply in case someone needs the info.
The trick is to use the prefix ":/" at the beginning of an image path, to let 
Qt load the image file from Maya's Qt resource.

ample to run from the script editor:

from PySide import QtGui, QtCore
test = QtGui.QWidget()
layout = QtGui.QHBoxLayout()
test.setLayout(layout)
test.show()

icon = QtGui.QIcon(":/cube.png")
button = QtGui.QToolButton()
button.setFixedSize(24,24)
button.setIcon(icon)
button.setIconSize(QtCore.QSize(20,20))

layout.addWidget(button)

How to know which bitmaps are available in Maya?  Launch the Resource Browser 
with this code

import maya.app.general.resourceBrowser as resourceBrowser
resBrowser = resourceBrowser.resourceBrowser()
path = resBrowser.run()


On Wednesday, March 6, 2013 11:53:20 AM UTC-5, oglop wrote:
> hi all.
> i could find all the icons after maya 2001 with this 
> cmds.resourceManager(nameFilter="*")
> 
> 
> 
> i known i can use these icons if i use python for maya command to do the gui,
> eg.
> cmds.iconTextButton( style='iconOnly', image1='spotlight.png', label='xxx' )
> 
> but i want to make a pyqt gui, show the icon with QLabel
> how could i use the icon in my pyqt gui ? since these images don't exist in 
> any folder. shall i use the following command to save all of them to a temp 
> folder?
> 
> cmds.resourceManager(saveAs=(resName, path))

-- 
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_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to