Reputation: 1
I'm trying to make a PySide application. I've watched some tutorials to try to solve the problem but none worked and i do not have any errors in my code. Here's the file where i'd do the scripting main.py
import sys
from PySide import QtGui
from ui import Ui_Form
class Main(QtGui.QMainWindow):
def __init__(self):
super(QtGui.QMainWindow)
self.ui = Ui_Form()
self.ui.setupUi(self)
if __name__ == '__init__':
app = QtGui.QApplication(sys.argv)
wid = QtGui.QWidget()
wid.resize(250, 150)
wid.setWindowTitle('Simple')
wid.show()
sys.exit(app.exec_())
Upvotes: 0
Views: 775
Reputation: 1
Well i just realized that i never actually ran self.show(). Problem solved
Upvotes: -1
Reputation: 142651
It has to be '__main__'
if __name__ == '__main__':
You have class Main()
but you don't use it
wid = Main()
You have to execute super()
in correct way
super(Main, self).__init__()
BTW: and you have wrong indentions inside class
Working example - without ui
because I don't have it - but it shows window.
from PySide import QtGui
import sys
#from ui import Ui_Form
class Main(QtGui.QMainWindow):
def __init__(self):
super(Main, self).__init__()
#self.ui = Ui_Form()
#self.ui.setupUi(self)
self.resize(250, 150)
self.setWindowTitle('Simple')
self.show()
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
wid = Main()
sys.exit(app.exec_())
Upvotes: 2