473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

thumbnails in Qfilediloug using pyqt

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
  2.  
  3. # openfiledialog.py
  4.  
  5. import sys
  6. from PyQt4 import QtGui
  7. from PyQt4 import QtCore
  8.  
  9.  
  10. class OpenFile(QtGui.QMainWindow):
  11.     def __init__(self, parent=None):
  12.         QtGui.QMainWindow.__init__(self, parent)
  13.  
  14.         self.setGeometry(300, 300, 350, 300)
  15.         self.setWindowTitle('OpenFile')
  16.  
  17.         self.textEdit = QtGui.QTextEdit()
  18.         self.setCentralWidget(self.textEdit)
  19.         self.statusBar()
  20.         self.setFocus()
  21.  
  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)
  26.  
  27.         menubar = self.menuBar()
  28.         file = menubar.addMenu('&File')
  29.         file.addAction(exit)
  30.  
  31.     def showDialog(self):
  32.         filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
  33.                     '/home')
  34.         file=open(filename)
  35.         data = file.read()
  36.         self.textEdit.setText(data)
  37.  
  38. app = QtGui.QApplication(sys.argv)
  39. cd = OpenFile()
  40. cd.show()
  41. app.exec_()
Dec 12 '08 #1
1 2942
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

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

Similar topics

10
by: Ilya Knizhnik | last post by:
Dear All, I am fairly new to Python. I have found it an easy language to learn and a very usefull one for many tasks. Currently I am working on a python project that involves a GUI and it was...
35
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another...
8
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to...
3
by: Fabio | last post by:
Hi all, I'm about to write an application, and I'd like to use PyQt, but before choosing this toolkit I would like to clarify some particular licensing issues; if some user has already touched...
3
by: Kenneth McDonald | last post by:
If this is not an appropriate newsgroup for this type of posting, please let me know and (if possible) suggest an alternative. I've done a fair bit of research on the net, but information is...
6
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the...
3
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python...
1
by: Peter TB Brett | last post by:
Hi folks, Although the PyQt documentation indicates that QGLWidget & friends have been ported to Python for the PyQt bindings, I'm not entirely sure what's necessary to make the normal...
5
by: Alex Teiche | last post by:
Hello, I am pretty new to Python, and have never learned C++. I am trying to implement the following thing into my python application: http://doc.trolltech.com/4.3/qsystemtrayicon.html ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.