[PyQt] Button Color
Josh Stratton
strattonbrazil at gmail.com
Tue Aug 16 23:26:48 BST 2011
That looks like the default button that has focus if you were to hit
"Enter" sending an event to that button. Like if you were to hit tab,
the second button would receive the focus. You can check if the
button has focus by calling hasFocus() or clearing it by calling
clearFocus(). That should remove the focus (and coloring) if you
don't want it there.
On Tue, Aug 16, 2011 at 3:03 PM, uahmed <gleam.uahmed at gmail.com> wrote:
> Hi ,
>
> I am new in Pyqt , i am confuse on one thing whenever i make buttons the
> first button color always have reddish layer . I am also attaching the code
> and Screen Shot .
>
> import sys
> from PyQt4 import QtGui, QtCore
>
> app = QtGui.QApplication(sys.argv)
> widget = QtGui.QWidget()
>
> widget.setGeometry(200, 100, 400, 300)
> widget.setWindowTitle('PyQt Application')
>
> close = QtGui.QPushButton(QtGui.QIcon('default.gif'), 'Close', widget)
> close.setGeometry(10, 10, 100, 30)
> close1 = QtGui.QPushButton(QtGui.QIcon('default.gif'), 'Close', widget)
> close1.setGeometry(10, 50, 100, 30)
>
> def hello():
> print 'hello everybody'
>
> widget.connect(close, QtCore.SIGNAL('clicked()'), hello)
> widget.connect(close1, QtCore.SIGNAL('clicked()'), hello)
>
> widget.show()
> sys.exit(app.exec_())
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list