Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. import problem under PyCharm uic is not found
Qt 6.11 is out! See what's new in the release blog

import problem under PyCharm uic is not found

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 3 Posters 3.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    McAce
    wrote on last edited by
    #1

    have an import problem under PyCharm uic is not found
    OS: Ubuntu 20.04

    import sys
    
    from PyQt5 import QtCore, QtGui, QtWidgets, uic
    
    class MainWindow(QtWidgets.QMainWindow):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            loadUi("first_test.ui")
    
    app = QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    app.exec_()
    

    PyQt5 5.15.4
    pyqt5-plugins 5.15.4.2.2
    PyQt5-qt5 5.15.2
    PyQt5-sip 12.11.0
    pyqt5-tools 5.15.4.3.2

    Any Ideas

    Thanks

    McAce

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      uic is a command line tool, it's not something you import.

      It might not be completely accurate in the case of PyQt5, see answer below for more details.

      [edit: added more details SGaist]

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      1
      • M Offline
        M Offline
        McAce
        wrote on last edited by
        #3

        Ah Okay now I understand it all, I was missing this info.

        Thanks

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          uic is a command line tool, it's not something you import.

          It might not be completely accurate in the case of PyQt5, see answer below for more details.

          [edit: added more details SGaist]

          T Offline
          T Offline
          TheNoodleNator
          wrote on last edited by
          #4

          @SGaist Hi, if it wasnt meant to be imported. Why is there documentation found here that shows us how to import it?

          SGaistS 1 Reply Last reply
          0
          • T TheNoodleNator

            @SGaist Hi, if it wasnt meant to be imported. Why is there documentation found here that shows us how to import it?

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            @TheNoodleNator said in import problem under PyCharm uic is not found:

            @SGaist Hi, if it wasnt meant to be imported. Why is there documentation found here that shows us how to import it?

            I learned something new, thanks !
            It's something that is specific to PyQt5 and quite frankly I have never came across it until now. From a quick look, it does not seem to be documented as public API to be used by Qt applications.
            The main things I found boils down to: python3 -m PyQt5.uic.pyuic mywidget.ui -o mywidget.py
            The standard way to use .ui files is through the QtDesigner module either by using pyuic5 to generate a python file from your .ui file or use of the QUiLoader class. See here for a more detailed explanation.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved