#!/usr/bin/python # -*- coding: utf-8 -*- import sys from portscan import PortScan from PyQt4 import QtGui, QtCore class MainClass(QtGui.QMainWindow): def __init__(self): super(MainClass, self).__init__() self.initUI() def initUI(self): self.resize(500,300) self.center() self.setWindowTitle('FDN - VPN configuration generator') self.statusBar().showMessage('Ready') qbtn = QtGui.QPushButton('Quit', self) qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit) qbtn.resize(qbtn.sizeHint()) ps = PortScan() ports = ps.portscan() for i in ports: portlabel = QtGui.QPushButton(str(i), self) self.show() def center(self): qr = self.frameGeometry() cp = QtGui.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) def main(): app = QtGui.QApplication(sys.argv) ex = MainClass() sys.exit(app.exec_()) if __name__ == '__main__': main()