I'm a new programmer, sorry If my question is too basic
I created a mybutton.ui file in Qt Designer, Then I want to run it through my python app. the mybutton.ui file is next to Qt-Designer-GUI-Code.py file. and this is my code:
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5 import uic
import sys
class UI(QWidget):
def __init__(self):
super().__init__()
uic.loadUi("mybutton.ui", self)
app = QApplication(sys.argv)
window = UI()
window.show()
app.exec__()
when I run the app I see this error:
PC1:Coursera ashkan$ python3 -u "/Users/ashkan/Desktop/Coursera/GUI/tempCodeRunnerFile.py"
Traceback (most recent call last):
File "/Users/ashkan/Desktop/Coursera/GUI/tempCodeRunnerFile.py", line 11, in <module>
window = UI()
File "/Users/ashkan/Desktop/Coursera/GUI/tempCodeRunnerFile.py", line 8, in __init__
uic.loadUi("mybutton.ui", self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyQt5/uic/__init__.py", line 238, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyQt5/uic/Loader/loader.py", line 66, in loadUi
return self.parse(filename, resource_suffix)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyQt5/uic/uiparser.py", line 1020, in parse
document = parse(filename)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
tree.parse(source, parser)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/etree/ElementTree.py", line 569, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'mybutton.ui'
I checked my code and it was completely look like the training I follow. I searched the web and I couldn't solve it.