Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When I click Run I see nothing

When I click Run I see nothing

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 3 Posters 692 Views
  • 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.
  • JonBJ JonB

    @hernancrespo89
    I'm still a touch perplexed at the possible absence of one line in the code you show.

    At the end of setupUi(), just before the self.retranslateUi(Form):

            self.horizontalLayout.addWidget(self.frame)
    
            self.retranslateUi(Form)
    

    I was expecting to see something which set the Form QWidget's to have self.horizontalLayout as its layout. Without that you would get the frame of the widget with title but not content, just as your screenshot shows.

    EDIT OK, I see self.horizontalLayout = QtWidgets.QHBoxLayout(Form) early on, that should do it.

    OK, it's time to crack open the (excellent) PyCharm debugger and see where stepping through your code takes you. Any time you spend learning it now will reward you in spades in later life :)

    H Offline
    H Offline
    hernancrespo89
    wrote on last edited by hernancrespo89
    #8

    @JonB said in When I click Run I see nothing:

    OK, it's time to crack open the (excellent) PyCharm debugger and see where stepping through your code takes you. Any time you spend learning it now will reward you in spades in later life :)

    Thanks for all your answers. But first time it GUI shows up, I see that blank. So, I am unable to understand which Widget causes problem. :( how can I debug itUntitled.png

    JonBJ 1 Reply Last reply
    0
    • H hernancrespo89

      @JonB said in When I click Run I see nothing:

      OK, it's time to crack open the (excellent) PyCharm debugger and see where stepping through your code takes you. Any time you spend learning it now will reward you in spades in later life :)

      Thanks for all your answers. But first time it GUI shows up, I see that blank. So, I am unable to understand which Widget causes problem. :( how can I debug itUntitled.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #9

      @hernancrespo89
      Just for now, comment out all the stuff after loadUi(...). Let's just see whether something you are doing prevents the widget from showing properly. To start with all you're supposed to be trying is seeing how the code you originally showed is working.

      Also what is that loadUi() about? I thought you were testing the file you showed was generated, it's a standalone python program?

      Are you somehow using both pyuic5 and ui.loadUi()? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-ui

      If you are currently generating, say, view.py (as shown earlier) from view.ui, as I said you should at least try running python view.py.

      H 1 Reply Last reply
      0
      • JonBJ JonB

        @hernancrespo89
        Just for now, comment out all the stuff after loadUi(...). Let's just see whether something you are doing prevents the widget from showing properly. To start with all you're supposed to be trying is seeing how the code you originally showed is working.

        Also what is that loadUi() about? I thought you were testing the file you showed was generated, it's a standalone python program?

        Are you somehow using both pyuic5 and ui.loadUi()? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-ui

        If you are currently generating, say, view.py (as shown earlier) from view.ui, as I said you should at least try running python view.py.

        H Offline
        H Offline
        hernancrespo89
        wrote on last edited by
        #10

        @JonB said in When I click Run I see nothing:

        @hernancrespo89
        Just for now, comment out all the stuff after loadUi(...). Let's just see whether something you are doing prevents the widget from showing properly. To start with all you're supposed to be trying is seeing how the code you originally showed is working.

        I commented out all the stuff after loadUi and I see still blank GUI.

        Also what is that loadUi() about? I thought you were testing the file you showed was generated, it's a standalone python program?

        Are you somehow using both pyuic5 and ui.loadUi()? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-ui

        No, I am using, only ui.loadUi(). I just wanted to show code behind my GUI and I used pyuic5 for that purpose. (just for posting here) . I have a main.py and view.py i call my GUI using ui.loadUi() in view.py

        If you are currently generating, say, view.py (as shown earlier) from view.ui, as I said you should at least try running python view.py.

        So, I am not geberating view.py

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

          Hi,

          I just copy pasted your code and ran it directly in a virtualenv with the latest PyQt5 installed through and worked properly (on macOS).

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

          JonBJ H 3 Replies Last reply
          0
          • SGaistS SGaist

            Hi,

            I just copy pasted your code and ran it directly in a virtualenv with the latest PyQt5 installed through and worked properly (on macOS).

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #12

            @SGaist
            But the OP is saying that is not his code, he isn't using pyuic...!
            He is using loadUi() on his ,ui file instead.... :)

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

              @JonB I meant the code from his original post.

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

              JonBJ 1 Reply Last reply
              0
              • SGaistS SGaist

                @JonB I meant the code from his original post.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #14

                @SGaist
                I know! But he only posted it as an example to illustrate his .ui file :)

                I suggested he verify the pyuic output he posted worked as standalone.

                So his question is why it doesn't work from uic.loadUi(). Assuming that's what loadUi() calls.

                H 1 Reply Last reply
                0
                • JonBJ JonB

                  @SGaist
                  I know! But he only posted it as an example to illustrate his .ui file :)

                  I suggested he verify the pyuic output he posted worked as standalone.

                  So his question is why it doesn't work from uic.loadUi(). Assuming that's what loadUi() calls.

                  H Offline
                  H Offline
                  hernancrespo89
                  wrote on last edited by
                  #15

                  @JonB said in When I click Run I see nothing:

                  @SGaist
                  I know! But he only posted it as an example to illustrate his .ui file :)

                  I suggested he verify the pyuic output he posted worked as standalone.

                  So his question is why it doesn't work from uic.loadUi(). Assuming that's what loadUi() calls.

                  Do you mean this by saying standalone?

                  from PyQt5.QtWidgets import *
                  from PyQt5.uic import loadUi
                  
                  class loadUi_example(QMainWindow):
                  
                      def __init__(self):
                          super().__init__()
                          loadUi("view.ui", self)
                  
                  app = QApplication([])
                  window = loadUi_example()
                  window.show()
                  app.exec_()
                  
                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Hi,

                    I just copy pasted your code and ran it directly in a virtualenv with the latest PyQt5 installed through and worked properly (on macOS).

                    H Offline
                    H Offline
                    hernancrespo89
                    wrote on last edited by
                    #16
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Hi,

                      I just copy pasted your code and ran it directly in a virtualenv with the latest PyQt5 installed through and worked properly (on macOS).

                      H Offline
                      H Offline
                      hernancrespo89
                      wrote on last edited by
                      #17

                      @SGaist said in When I click Run I see nothing:

                      Hi,

                      I just copy pasted your code and ran it directly in a virtualenv with the latest PyQt5 installed through and worked properly (on macOS).

                      Thank you, yes I can work it, too. But when i try to import it using uic.loadUi(). I see blank screen.

                      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