[PyQt] thumbnails in Qfilediloug

Waseem Bourgi alwaseem307ster at yahoo.com
Fri Dec 12 04:03:12 GMT 2008


hey folks;
 

i am working on my program using python and PYQT that is suppose to
load digital photos into the main interface of my program and perform
few action on them. i have here the codes that will prompt me to brows
to the system directory and show the system files and any other files.
any way the codes here deal only with text files and loads only one
file at the time. my question how can i alter the code to deal with
digital photos and be able to load photos to the system in thumbnails.

thanks

here's the codes

#!/usr/bin/python
 
# openfiledialog.py
 
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
 
 
class OpenFile(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
 
        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('OpenFile')
 
        self.textEdit = QtGui.QTextEdit()
        self.setCentralWidget(self.textEdit)
        self.statusBar()
        self.setFocus()
 
        exit = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self)
        exit.setShortcut('Ctrl+O')
        exit.setStatusTip('Open new File')
        self.connect(exit, QtCore.SIGNAL('triggered()'), self..showDialog)
 
        menubar = self.menuBar()
        file = menubar.addMenu('&File')
        file.addAction(exit)
 
    def showDialog(self):
        filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
                    '/home/')
        file=open(filename)
        data = file.read()
        self.textEdit.setText(data)
 
app = QtGui.QApplication(sys.argv)
cd = OpenFile()
cd.show()
app.exec_()
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081212/61636dc3/attachment.html


More information about the PyQt mailing list