Есть код:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys, os
from mainwindow_ui import *
class mainwindow(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self)
self.setupUi(self)
self.connect(self.leftListWidget, QtCore.SIGNAL('doubleClicked(QModelIndex)'), self, QtCore.SLOT('itemClicked(item)'))
self.connect(self.exitButton, QtCore.SIGNAL('clicked()'), self.exitAction)
self.updateLeftList(os.path.expanduser("~"))
self.updateRightList(os.path.expanduser("~"))
def updateLeftList(self, directory):
files = os.listdir(directory)
for f in files:
self.leftListWidget.addItem(f)
def updateRightList(self, directory):
files = os.listdir(directory)
for f in files:
self.rightListWidget.addItem(f)
def itemClicked(self, item):
messageBox = QMessageBox(self)
messageBox.setText("Hello")
messageBox.show()
def exitAction(self):
self.close()