I just started creating GUI's in PyQt and I wanted to add pixmap
as a background on buttons, as icons etc.
And I have these questions:
If I ever compile
.py
to.exe
, how can I include folders with resource files and images in it?How can I import resource files in code? For example, I have a resource file,
Test.png
, how can I call it?class Window(QtGui.QMainWindow):
def __init__(self): super(Window, self).__init__() self.setGeometry(0, 0, 1280, 800) self.setWindowTitle("Window") self.setWindowIcon(QtGui.QIcon('Test.png')) # < How can I import resource file here?
How can I generate resource files?
If resource files and pictures are in same folder, do I still need to specify full path?
What do I need, To organize Python code for a good application? (Do I need something other than resource file or Python code?)
Why are they so useful? Do I still need the original picture when I generate a resource file, or does it compile every pixel as useful code?