I'm learning to use the pyqt libraries and this code won't work (no output):
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pomocni import Ui_MainWindow
from PyQt4.QtGui import QMainWindow, QApplication
from PyQt4 import QtCore
import sys
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
def start():
window = MainWindow()
window.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
start()
sys.exit(app.exec_())
Doing it this way, and everything is OK:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pomocni import Ui_MainWindow
from PyQt4.QtGui import QMainWindow, QApplication
from PyQt4 import QtCore
import sys
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
What am I doing wrong?