I am calling print just after using connect method . I think you are right it might get focus after displayed . <br><br><br><div class="gmail_quote">On Wed, Aug 17, 2011 at 3:35 AM, Josh Stratton <span dir="ltr"><<a href="mailto:strattonbrazil@gmail.com">strattonbrazil@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I would assume it should print true if it's focused. Where are you<br>
calling print? It might receive focus after you check if it has<br>
focus. It might receive focus after the window is displayed. Not<br>
sure, but that's a guess.<br>
<div><div></div><div class="h5"><br>
On Tue, Aug 16, 2011 at 3:32 PM, uahmed <<a href="mailto:gleam.uahmed@gmail.com">gleam.uahmed@gmail.com</a>> wrote:<br>
> Hi<br>
><br>
> Thanks for the reply yes it is like that When i press tab it moves to next<br>
> button but When i use this command<br>
><br>
> print close.hasFocus()<br>
><br>
> It prints False , Does it indicate that it dont have Focus ?<br>
><br>
> Thank You<br>
><br>
> On Wed, Aug 17, 2011 at 3:26 AM, Josh Stratton <<a href="mailto:strattonbrazil@gmail.com">strattonbrazil@gmail.com</a>><br>
> wrote:<br>
>><br>
>> That looks like the default button that has focus if you were to hit<br>
>> "Enter" sending an event to that button. Like if you were to hit tab,<br>
>> the second button would receive the focus. You can check if the<br>
>> button has focus by calling hasFocus() or clearing it by calling<br>
>> clearFocus(). That should remove the focus (and coloring) if you<br>
>> don't want it there.<br>
>><br>
>> On Tue, Aug 16, 2011 at 3:03 PM, uahmed <<a href="mailto:gleam.uahmed@gmail.com">gleam.uahmed@gmail.com</a>> wrote:<br>
>> > Hi ,<br>
>> ><br>
>> > I am new in Pyqt , i am confuse on one thing whenever i make buttons the<br>
>> > first button color always have reddish layer . I am also attaching the<br>
>> > code<br>
>> > and Screen Shot .<br>
>> ><br>
>> > import sys<br>
>> > from PyQt4 import QtGui, QtCore<br>
>> ><br>
>> > app = QtGui.QApplication(sys.argv)<br>
>> > widget = QtGui.QWidget()<br>
>> ><br>
>> > widget.setGeometry(200, 100, 400, 300)<br>
>> > widget.setWindowTitle('PyQt Application')<br>
>> ><br>
>> > close = QtGui.QPushButton(QtGui.QIcon('default.gif'), 'Close', widget)<br>
>> > close.setGeometry(10, 10, 100, 30)<br>
>> > close1 = QtGui.QPushButton(QtGui.QIcon('default.gif'), 'Close', widget)<br>
>> > close1.setGeometry(10, 50, 100, 30)<br>
>> ><br>
>> > def hello():<br>
>> > print 'hello everybody'<br>
>> ><br>
>> > widget.connect(close, QtCore.SIGNAL('clicked()'), hello)<br>
>> > widget.connect(close1, QtCore.SIGNAL('clicked()'), hello)<br>
>> ><br>
>> > widget.show()<br>
>> > sys.exit(app.exec_())<br>
>> ><br>
>> > _______________________________________________<br>
>> > PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
>> > <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>