1

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:

  1. If I ever compile .py to .exe, how can I include folders with resource files and images in it?

  2. 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?
    
  3. How can I generate resource files?

  4. If resource files and pictures are in same folder, do I still need to specify full path?

  5. What do I need, To organize Python code for a good application? (Do I need something other than resource file or Python code?)

  6. 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?

Jason
  • 2,278
  • 2
  • 17
  • 25
ShellRox
  • 2,532
  • 6
  • 42
  • 90
  • 1
    I suppose you need answer to this question: http://stackoverflow.com/questions/10951608/resource-file-in-pyqt4 – fghj Apr 16 '16 at 19:59
  • 2
    This is a lot more than one question: pretty much like a request for a tutorial, which is not really appropriate for Stack Overflow. I recommend breaking it up into single questions, and more thoroughly research each one, because some are already answered, so you won't need to ask them again. For instance: http://stackoverflow.com/a/22517901/1886357 – eric Apr 17 '16 at 02:44
  • Thanks and sorry for making this, But how can i import resource file in pyqt code? without using qt designer. – ShellRox Apr 17 '16 at 05:29

0 Answers0