[PyQt] Populating a listWidget with a list of files
jaybstory
jaybstory at yahoo.com
Sat Mar 6 01:10:13 GMT 2010
Here is a example of something similar to what I want to achieve but this is
not in python which is why I'm not quite understanding it:
http://www.qtforum.org/article/28565/how-to-enable-or-disable-a-qpushbutton-based-on-the-selection-state-of-a-qlistwidgetitem.html
Still looking for advice on how to achieve this.
jaybstory wrote:
>
> Hello,
>
> I wanted to know how to have a list widget contain a list of files.
> Basically, I want to be able to give a path to a list of video files and
> have the video file names displayed in a list widget. Then I want the
> user be able to click a file which will open an external program.
>
> I can already have the user click a button which opens files using
> QFileDialog. Then they can select a file which then opens VLC (I did this
> by using QProcess).
>
>
> Here is my code which can do what I mentioned above:
>
> #code for signal slot connection between the button and the def video
> function
>
> def video(self):
> fd2 = QtGui.QFileDialog(self)
> self.filename = fd2.getOpenFileName()
> from os.path import isfile
> if isfile(self.filename):
> import codecs
> s = codecs.open(self.filename,'r').read()
> #z = self.filename
> # print z
> video = QtCore.QProcess(self)
> a = "vlc "+z
> video.start(a)
>
>
> I now want to know how to place the list of files into a list Widget.
> Thank you in advance.
>
--
View this message in context: http://old.nabble.com/Populating-a-listWidget-with-a-list-of-files-tp27776406p27801160.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list