[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] window background
From:       Kerri Reno <kreno () yumaed ! org>
Date:       2007-03-21 19:51:50
Message-ID: 46018CD6.7080804 () yumaed ! org
[Download RAW message or body]

I'm trying to put our system logo in the background of our main window.
It works fine on Windows XP, but on Linux, the image flashes on the
screen, and then goes black.  The palette is set to a white brush with a
pixmap.  Below is example code containing the attached x.jpg.  I hope
someone out there has an idea, this is driving me nuts!  (it flashes
really quickly with such a small jpg, if you want a bigger one, let me know)

Thanks in advance,
Kerri

-----------------code here--------------------------------------------
#!/usr/bin/env python
# vim:set ts=4:set ff=unix

import sys
from PyQt4 import QtGui, QtCore

class MainWindow(QtGui.QMainWindow):

     def __init__(self):
         QtGui.QMainWindow.__init__(self)

         self.resize(QtCore.QSize(QtCore.QRect(0,0,800,600).size()).expan
dedTo(self.minimumSizeHint()))

         self.setMinimumSize(QtCore.QSize(200,200))

         self.menubar = QtGui.QMenuBar(self)
         self.setMenuBar(self.menubar)

         self.menuFile = QtGui.QMenu(self.menubar)
         self.menuFile.setTitle("&File")

         self.actionExit = QtGui.QAction(self)
         self.actionExit.setText("E&xit")
         self.connect(self.actionExit,
                  QtCore.SIGNAL("activated()"),
                  self.close)
         self.menuFile.addAction(self.actionExit)
         self.menubar.addAction(self.menuFile.menuAction())

         p = QtGui.QPalette()
         brush = QtGui.QBrush(QtCore.Qt.white,QtGui.QPixmap('x.jpg'))
         p.setBrush(QtGui.QPalette.Active,QtGui.QPalette.Window,brush)
         p.setBrush(QtGui.QPalette.Inactive,QtGui.QPalette.Window,brush)
         p.setBrush(QtGui.QPalette.Disabled,QtGui.QPalette.Window,brush)
         self.setPalette(p)

         self.show()

def main(args):
     app = QtGui.QApplication(args)
     mainWindow = MainWindow()
     sys.exit(app.exec_())

if __name__ == '__main__':
     main(sys.argv)

------------------------end code--------------------------------------
-- 
Yuma Educational Computer Consortium
Compass Development Team
Kerri Reno
kreno@yumaed.org      (928) 502-4240




["x.jpg" (image/jpeg)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic