Results 1 to 17 of 17

Thread: Import uic or use pyuic4?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ChrisOfBristol Guest

    Default Re: Import uic or use pyuic4?

    I've now switched to Python3 and PyQt5, QtWidgets are separate in PyQt5 so a few minor changes are needed to make this script work:
    Qt Code:
    1. #! /usr/bin/python3
    2.  
    3. import sys
    4. from PyQt5 import QtCore, QtGui, QtWidgets #
    5. from image3d_ui import Ui_MainWindow
    6.  
    7. class MyWindowClass(QtWidgets.QMainWindow): #
    8. def __init__(self, parent=None):
    9. QtWidgets.QMainWindow.__init__(self, parent) #
    10. self.ui = Ui_MainWindow()
    11. self.ui.setupUi(self)
    12.  
    13. self.ui.pushButton.clicked.connect(self.pushButtonClicked)
    14.  
    15. def pushButtonClicked(self):
    16. print ('OK')
    17.  
    18. if __name__ == "__main__":
    19. app = QtWidgets.QApplication(sys.argv) #
    20. mywindow = MyWindowClass()
    21. mywindow.show()
    22. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisOfBristol; 4th April 2015 at 12:10.

Similar Threads

  1. QML's import does not work
    By MarkoSan in forum Qt Programming
    Replies: 9
    Last Post: 8th September 2014, 13:33
  2. [RESOLVED] PyQt4: pyuic4.bat throws exception
    By rherzog in forum Qt Programming
    Replies: 0
    Last Post: 4th June 2014, 11:18
  3. Import QtQuick 2.0 or 2.1 or 2.2?
    By pherthyl in forum Qt Quick
    Replies: 2
    Last Post: 9th January 2014, 20:13
  4. ImportError: Cannot import name
    By wanmonk in forum Qt Programming
    Replies: 4
    Last Post: 16th December 2013, 05:32
  5. Qt 4.5 import stylesheet
    By dcoppenb in forum Qt Programming
    Replies: 0
    Last Post: 7th March 2013, 12:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.