[PyQt] building file dialoug

klia alwaseem307ster at yahoo.com
Thu Jan 22 05:13:11 GMT 2009


hello folks;

i am trying to build to a file dialog that i can use to brows through my
home directory and files and be able to chose multiple photos and load them
to the application front..

i am stuck with theses codes,,,,,,,,,,,any ideas

Thanks in advance 

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_()
-- 
View this message in context: http://www.nabble.com/building-file-dialoug-tp21596605p21596605.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list