Displaying Images in QListView with same thumbnail size keeping aspect rati Programming Software Development by krystosan …(self, index, role): if index.isValid() and role == QtCore.Qt.DecorationRole: return QtGui.QIcon(QtGui.QPixmap(self.listdata[index.row()])) if… Re: Displaying Images in QListView with same thumbnail size keeping aspect rati Programming Software Development by Andrei_1 try this : def data(self, index, role): if index.isValid() and role == QtCore.Qt.DecorationRole: s = QtCore.QSize(250, 200) pict = QtGui.QIcon(QtGui.QPixmap(self.listdata[index.row()]).scaled(s)) return pict Re: Displaying Images in QListView with same thumbnail size keeping aspect rati Programming Software Development by krystosan …(self, index, role): if index.isValid() and role == QtCore.Qt.DecorationRole: s = QtCore.QSize(250, 200) return QtGui.QIcon(QtGui.QPixmap… need serious help setting up images height width in QTableView Programming Software Development by krystosan … QtCore.QString(fileName) if index.isValid() and role == QtCore.Qt.DecorationRole: row = index.row() column = index.column() value = self._listdata[row… What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by Odyssey2001 …).__init__(parent) def data(self, index, role): if role == Qt.DecorationRole: node = self.nodeFromIndex(index) if node is None: return QVariant… Re: Displaying Images in QListView with same thumbnail size keeping aspect rati Programming Software Development by vegaseat What version are you using? QVariant() hasn't been around for ages! Re: Displaying Images in QListView with same thumbnail size keeping aspect rati Programming Software Development by krystosan i am using Qt 4.8.2 Re: What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by HiHe The MainForm `__init__` arguments are (self, filename, nesting, separator, parent=None) and should give you a hint The author of the book does not do any necessary commenting and should be discounted. I would return the lousy book. Re: What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by juanpa_2510 __file__ is the name of de module file that is actually in use. os.path.dirname gets the directory path where the __file__ is stored. os.path.join creates a new path concatenating first argument to second argument. Re: What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by Odyssey2001 Thank you -both of you- for your time and for your answers! @HiHe : It's actually a very good book.The writer explains most of the code in the book.It's entirely my fault.It's just that I'm a beginner in programming and I can't understand some parts of the code if they are not explained in detail (or at all). Re: What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by vegaseat One good tool to see what is going on in strange code is to put in temporary test print() Re: What is this code doing(Rapid Gui Programming with Python and Qt) Programming Software Development by Odyssey2001 Although I'm a little bit late,thank you!!!I'll keep that in mind!