python - create main script to use PyQt4 windows with other objects -


i trying learn how use python , pyqt. have done window qtcreator used pyuic4, have created class called ruban use window interface. in window have button called nouveauruban. create object class ruban when button clicked.

i know code wrong, problem may @ initial part of maintn, on __init__ ?

# -*- coding: utf-8 -*-  import sys pyqt4.qtcore import * pyqt4.qtgui import * mainwindow import ui_mainwindow ruban import ruban  class maintm(qmainwindow, ui_mainwindow):      def __init__(self, parent=none): #, parent=none ??         super (maintm, self).__init__(self, parent) #(parent) ??         self.createwidgets()         self.nouveauruban.connect(nouveauruban, qtcore.signal(_fromutf8("clicked()")), self.nvruban)      def nvruban(self):         self.ruban=ruban()         self.ruban.info_ruban()      def createwidgets(self):         self.ui=ui_mainwindow()         self.ui.setupui(self)   if __name__== "__main__":     app=qapplication(sys.argv)     myapp=maintm()     myapp.show()     sys.exit(app.exec_()) 

here re-write of script should fix problems:

import sys pyqt4.qtcore import * pyqt4.qtgui import * mainwindow import ui_mainwindow ruban import ruban  class maintm(qmainwindow, ui_mainwindow):      def __init__(self, parent=none):         super(maintm, self).__init__(parent)         self.setupui(self)         self.nouveauruban.clicked.connect(self.nvruban)      def nvruban(self):         self.ruban = ruban()         self.ruban.info_ruban()  if __name__== '__main__':      app = qapplication(sys.argv)     myapp = maintm()     myapp.show()     sys.exit(app.exec_()) 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -