MillaSense | 2021-01-19 17:13:30 UTC | #1
In your packaging "howto" (..tutorials/packaging-pyqt5-apps-fbs/):
from fbs_runtime.application_context.PyQt5 import ApplicationContext
class AppContext(ApplicationContext):
pythondef __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.window = Window() def run(self): self.window.show() return self.app.exec_()
is this a typo? Shouldn't it be:
pythondef __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)
If not.. sorry, couldn't find the AppContent.
But my main-question would be this: ..well, of course i stumbled upon fbs because i was having trouble with pure pyinstaller and setting up a proper .spec-file. I built my layout with Qt-Designer, so i got a .qrc file that i converted with pyrcc5 to a *_rc.py-file.
PyQt6 Crash Course — a new tutorial in your Inbox every day
Beginner-focused crash course explaining the basics with hands-on examples.
Where do i have to put this? How can i import/call it? ..or isn't this possible at all?
Thanks for your time! Have a great one.. And enjoy baby-time! (..they won't be that sweet, when they go through puberty.. like mine. :rofl:)
martin | 2021-01-21 12:40:37 UTC | #2
Hi @MillaSense welcome to the forum!
Thanks for the correction, yes that's a typo -- it's fixed now.
For the .py
file created using pyrcc5
you can just put this in the same folder as your main application and import it from there by name, e.g. if your file is named resources.py
just do
import resources
Or if you're using relative imports
from . import resources
Just importing it will cause the resources to be added to the Qt resource system, you don't need to do anything with the imported object.
There is a bit more about using QRC files in the PyInstaller tutorial -- it should be applicable here. The bundled app will just contain the .py
file, not the original .qrc
but that's OK, it's not needed anymore. Not 100% sure how this plays with fbs own resource system etc. would be interested to hear about it if you get it working!
MillaSense | 2021-01-22 08:56:13 UTC | #3
Errr.. I see, know what you're talking about, but honestly..
Nope, didn't make it - made THAT mistake, i.e. i was using 3.9.1 (that isn't supported by fbs), tried it with 3.6.0 before you answered, what didn't work out - went back to pyinstaller via terminal (cmd), edited the .spec-file (of course forgot to include the *_rc.py-file, what took me two hours to find and include..) and finally got my executable.
Thanks for your efforts, Senior! Awesome website, will surely visit you from time to time.. (when i'm into Python.) Have a good one!