Unsolved When I click Run I see nothing
-
@JonB said in When I click Run I see nothing:
@hernancrespo89
I suggested you try to run your.py
file, notpyuic5 ... -o your.py
.I run .py file but I wanted to show codes, so I have added them to post.
-
@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
. -
@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).
-
@SGaist
But the OP is saying that is not his code, he isn't usingpyuic
...!
He is usingloadUi()
on his,ui
file instead.... :) -
@JonB I meant the code from his original post.
-
@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_()
-
This post is deleted! -
@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.