I am an absolute beginner with PyQt but I have fairly conversant with Python and Pygame. I am writing a file utility for Windows and I need to get either a directory path or paths of several selected files into a variable or a list. How is this possible using pyqt? I know how to do it with tk but I have compiling errors using tk. Please try to give me a direct answer to this question instead of finding fault with my approach to this matter. My code which I tried with pyqt is given below.
import sys
from PyQt4 import QtGui
class Qtthings(QtGui.QWidget):
def __init__(self):
super(Qtthings, self).__init__()
self.initUI()
def initUI(self):
self.resize(350, 450) # screen size xy
self.center()
self.setWindowTitle('Select Directory')
self.setWindowIcon(QtGui.QIcon('dg64.ico'))
self.fileDialog = QtGui.QFileDialog(self)
self.fileDialog.show()
def center(self):
qr = self.frameGeometry()
cp = QtGui.QDesktopWidget().availableGeometry().center() # get the screen center
qr.moveCenter(cp) # this where the frameshould move
self.move(qr.topLeft()) # move the top left in relation to the center
def main():
app = QtGui.QApplication(sys.argv)
ex = Qtthings()
#a = ex.fileDialog
sys.exit(app.exec_())
return
if __name__ == '__main__':
fp = main()
print fp