Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. French
  4. Affichage d'une interface PyQt6
Qt 6.11 is out! See what's new in the release blog

Affichage d'une interface PyQt6

Scheduled Pinned Locked Moved Solved French
3 Posts 2 Posters 1.4k 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.
  • K Offline
    K Offline
    KBEe
    wrote on last edited by
    #1

    J’ai avec Qt designer, j’ai créé une interface utilisateur que j’ai exportée et nommée gui.ui grâce à pyuic je les transformer en gui.py, mais maintenant, je ne sais pas comment lancer l’interface pour le lancer, j’ai utilisé ce code. ```

    from gui.gui import Ui_MainWindow

        app = QApplication(sys.argv)
        main_window = Ui_MainWindow()
        main_window.setupUi(main_window)
        main_window.setObjectName("MainWindow")
        main_window.show()
        sys.exit(app.exec_())
    
    la coloration syntaxique est bonne et tout est bon ... Mais j'ai une erreur
    
    

    Traceback (most recent call last):
    File "d:\Dev\Py\Projet\ATC IFR\ATCIFR\ATC-IFR\src\resources\app.py", line 21, in <module>
    main()
    File "d:\Dev\Py\Projet\ATC IFR\ATCIFR\ATC-IFR\src\resources\app.py", line 15, in main
    main_window.setupUi(main_window)
    File "d:\Dev\Py\Projet\ATC IFR\ATCIFR\ATC-IFR\src\resources\gui\gui.py", line 14, in setupUi
    MainWindow.setObjectName("MainWindow")
    ^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'Ui_MainWindow' object has no attribute 'setObjectName'```

    1 Reply Last reply
    0
    • SGaistS SGaist moved this topic from Qt for Python on
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Bonjour et bienvenu sur devnet,

      MainWindow est-elle basée sur QMainWindow ?

      Si c'est le cas, il faut créer un objet de cette classe et l'utiliser comme paramètre de setupUi et ensuite appeler show sur cet objet.

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

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Bonjour et bienvenu sur devnet,

        MainWindow est-elle basée sur QMainWindow ?

        Si c'est le cas, il faut créer un objet de cette classe et l'utiliser comme paramètre de setupUi et ensuite appeler show sur cet objet.

        K Offline
        K Offline
        KBEe
        wrote on last edited by
        #3

        @SGaist Merci pour votre aide, ça a marché.

        1 Reply Last reply
        0
        • K KBEe has marked this topic as solved on

        • Login

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