Miscellanious questions - mainly: What can i do with my pyrcc5'ed .qrc-file

Heads up! You've already completed this tutorial.

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):

def __init__(self, *args, **kwargs):
    super(AppContent, self).__init__(*args, **kwargs)

    self.window = Window()

def run(self):
    return self.app.exec_()

is this a typo? Shouldn't it be:

def __init__(self, *args, **kwargs):
    super(AppContext, self).__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.

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!

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Miscellanious questions - mainly: What can i do with my pyrcc5'ed .qrc-file was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.