Use forward slashes for paths. Even in windows: "images/icon_maya-small.png" "images/nuke.png"
Also be sure the relative paths are really working relative to your current location. It might be better to use a qt resource file or absolute paths. Or changing your cwd in your scripts. On Saturday, December 15, 2012, San Luthra wrote: > I have implemented a QListWidget and add items to it QListWidgetItems, > whats weird is the Icon shows up for the first block in if but not for the > elif block , i have checked it twice the path is right and even tried \\n > coz \n converts to newline, but icons doesnt shows up see this link Snowball > Batch Render in PyQt4 for Maya and > Nuke<http://www.youtube.com/watch?v=RgjbHz5o68w&t=3m5s&hd=1> > the code i am using to add items : > > def addToRenderQueue(self): > ext=os.path.splitext(str(self.scnFilePath.text()))[-1] > if self.mayachkBox.isChecked() and (ext=='.ma'): > img_mIcon=QtGui.QPixmap("images\icon_maya-small.png") > ntask=self.makeBatTask() > self.itemTask=QtGui.QListWidgetItem(ntask) > self.itemTask.setIcon(QtGui.QIcon(img_mIcon)) > self.listWidget.insertItem(0,self.itemTask) > elif self.nukechkBox.isChecked() and (ext=='.nk'): > img_nIcon=QtGui.QPixmap("images\nuke.png") > ntask=self.makeBatTask() > self.itemTask=QtGui.QListWidgetItem(ntask) > self.itemTask.setIcon(QtGui.QIcon(img_nIcon)) > self.listWidget.insertItem(0,self.itemTask) > > > if anyone can tell me why is it happening and how do I get QIcon to show > for the elif part too... > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To post to this group, send email to > [email protected]<javascript:;> > . > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected].
