[PyQt] Widget image coming on button

uahmed gleam.uahmed at gmail.com
Thu Dec 1 16:15:14 GMT 2011


Hi

I want to putt the background image in my pyqt application . I take a
widget and putt image through stylesheet but when i created button the
background image use for widget comes on button too  .

Code:

import sys,os
from functools import partial
from PyQt4 import QtGui, QtCore

app = QtGui.QApplication(sys.argv)
widget =QtGui.QWidget()
screen = QtGui.QDesktopWidget().screenGeometry()
widget = QtGui.QWidget()
screen_width = screen.width()
screen_height = screen.height()
widget.resize(screen_width, screen_height)
widget.setStyleSheet("border-image:url(Window/default.jpg)")
button = QtGui.QPushButton(widget)
button.setGeometry(200,500, 130, 130)
widget.show()
sys.exit(app.exec_())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20111201/6aaca405/attachment.html>


More information about the PyQt mailing list