Question

i wish make little gui with pyqt4 that show the output of "dir c:\windows\" line by line I'm looking for QlistView but i don't understand how do it. Can anyone help me?

Was it helpful?

Solution

Try QListWidget instead of QListView. QListWidget extends QListView and adds some very helpful methods like addItems.

I'm going to assume you know how to create the GUI part of the application using Designer.

If you have a QListWidget object qlistwidget, the code would be:

values = os.listdir("c:\\windows")

qlist = QtCore.QStringList(map(QtCore.QString, values))
qlistwidget.addItems(qlist)

OTHER TIPS

import os
for root, dirs, files in os.walk(r'C:\windows'):
    //add your QlistView add codes here
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top