[PyQt] Problem displaying pixmaps added in Qt Designer

Siddhu Warrier siddhu.warrier at ohmsurveys.com
Fri Apr 4 11:47:21 BST 2008


It would be great if you could help me resolve this please.

I have a .ui file with a custom .png icon, and a .png image in the
window (the .png file is displayed by a Label widget). I created the .ui
file using Qt Designer 4. The preview comes out perfect - the image file
is located in the same directory.

I load the .ui file using uic.loadUi(..) function in a PyQt4 program.
However, the images don't display (neither the icon nor the image , and
hence, the layout goes all awry! I have pasted the relevant sections of
the .ui file, and the .py file below.


1. The Form:
<widget class="QMainWindow" name="StackerMainForm" >
  <property name="windowIcon" >

2. The label:
<widget class="QLabel" name="label" >
    <property name="pixmap" >

3. The python code to load the UI:
class StackerMain(QtGui.QMainWindow):
    ## StackerMain constructor
    # This function loads the GUI/StackerMain.ui file
    def __init__(self, *args):
        #create the GUI.
        # load the GUI from the ui file.
        guiPath = "GUI/StackerMain.ui"
        uic.loadUi(guiPath, self)

Thanks a lot in advance,

Siddhu Warrier

Graduate Programmer

OHM plc

This message is confidential and intended solely for the use of the
person to whom it is addressed. The message, any attachments and
response string may contain privileged and confidential information. If
you have received this message in error, please notify the sender
immediately and remove it from your system. Thank you.

More information about the PyQt mailing list