By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

thumbnails in Qfilediloug using pyqt

P: 14
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 in advance

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/python
  3. #
  5. import sys
  6. from PyQt4 import QtGui
  7. from PyQt4 import QtCore
  10. class OpenFile(QtGui.QMainWindow):
  11.     def __init__(self, parent=None):
  12.         QtGui.QMainWindow.__init__(self, parent)
  14.         self.setGeometry(300, 300, 350, 300)
  15.         self.setWindowTitle('OpenFile')
  17.         self.textEdit = QtGui.QTextEdit()
  18.         self.setCentralWidget(self.textEdit)
  19.         self.statusBar()
  20.         self.setFocus()
  22.         exit = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self)
  23.         exit.setShortcut('Ctrl+O')
  24.         exit.setStatusTip('Open new File')
  25.         self.connect(exit, QtCore.SIGNAL('triggered()'), self.showDialog)
  27.         menubar = self.menuBar()
  28.         file = menubar.addMenu('&File')
  29.         file.addAction(exit)
  31.     def showDialog(self):
  32.         filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
  33.                     '/home')
  34.         file=open(filename)
  35.         data =
  36.         self.textEdit.setText(data)
  38. app = QtGui.QApplication(sys.argv)
  39. cd = OpenFile()
  41. app.exec_()
Dec 12 '08 #1
Share this Question
Share on Google+
1 Reply

P: 2
On Windows and Mac, QFileDialog generally starts up the native File dialog, in which these features are present. The same is also possible for GNOME when using QGtkStyle.

There, however, is no direct way to implement the file previewer in Qt 4.4. You may look at the Qt 3 support classes Q3FilePreview and Q3FileDialog both to implement this.
Dec 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.