When I click Run I see nothing
-
@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 theself.retranslateUi(Form)
:self.horizontalLayout.addWidget(self.frame) self.retranslateUi(Form)
I was expecting to see something which set the
Form
QWidget
's to haveself.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 :)
@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 it
-
@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 it
@hernancrespo89
Just for now, comment out all the stuff afterloadUi(...)
. 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
andui.loadUi()
? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-uiIf you are currently generating, say,
view.py
(as shown earlier) fromview.ui
, as I said you should at least try runningpython view.py
. -
@hernancrespo89
Just for now, comment out all the stuff afterloadUi(...)
. 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
andui.loadUi()
? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-uiIf you are currently generating, say,
view.py
(as shown earlier) fromview.ui
, as I said you should at least try runningpython view.py
.@JonB said in When I click Run I see nothing:
@hernancrespo89
Just for now, comment out all the stuff afterloadUi(...)
. 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
andui.loadUi()
? https://stackoverflow.com/questions/52471705/why-in-pyqt5-should-i-use-pyuic5-and-not-uic-loaduimy-uiNo, I am using, only
ui.loadUi()
. I just wanted to show code behind my GUI and I usedpyuic5
for that purpose. (just for posting here) . I have amain.py
andview.py
i call my GUI usingui.loadUi()
inview.py
If you are currently generating, say,
view.py
(as shown earlier) fromview.ui
, as I said you should at least try runningpython view.py
.So, I am not geberating
view.py
-
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).
-
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).
-
-
@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 whatloadUi()
calls.@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 whatloadUi()
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_()
-
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).
This post is deleted! -
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).
@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.