[PyKDE] QMessageBox.question bug?

Martin Wiechert martin.wiechert at gmx.de
Thu May 19 02:11:22 BST 2005


Thanks for your reply. Well, as I said I, had the same behaviour, as reported 
by you and the docs, before I updated my system, but now it changed:


IPython 0.6.11 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

IPython profile: scipy

In [1]: from qt import *

In [2]: import iqt

In [3]: x = QMessageBox.question (None, 'Caption', 'Text', QMessageBox.Yes,
   ...:                           QMessageBox.No, QMessageBox.Cancel)

In [4]: x # "Yes" clicked
Out[4]: 0

In [5]: x = QMessageBox.question (None, 'Caption', 'Text', QMessageBox.Yes,
   ...:                           QMessageBox.No, QMessageBox.Cancel)

In [6]: x # "No" clicked
Out[6]: 1

In [7]: x = QMessageBox.question (None, 'Caption', 'Text', QMessageBox.Yes,
   ...:                           QMessageBox.No, QMessageBox.Cancel)

In [8]: x # window closed without clicking a button
Out[8]: 2

In [9]: QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel
Out[9]: (3, 4, 2)


I'm lost.


Thanks, Martin.



On Thursday 19 May 2005 02:04, John Ridley wrote:
> Martin Wiechert wrote:
> > Other than before QMessageBox.question bug does not return the
>
> identity of the
>
> > user-clicked button (which it should according to qt docs, and indeed
>
> did for
>
> > me before), but rather seems to return 0 for the leftmost button, 1
>
> for the
>
> > next and so on. If one closes the dialog without clicking a button it
>
> returns
>
> > the index (not identity) of the rightmost button.
>
> The docs say QMessageBox.question returns an int from an enumeration
> starting with QMessageBox.NoButton == 0. And the docs don't lie:
>
> Python 2.4.1 (#1, Mar 31 2005, 21:33:58)
> [GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2
>
> >>> from qt import *
> >>> a = QApplication([])
> >>> (QMessageBox.NoButton,QMessageBox.Ok,
>
> ...  QMessageBox.Cancel,QMessageBox.Yes,
> ...  QMessageBox.No,QMessageBox.Abort,
> ...  QMessageBox.Retry,QMessageBox.Ignore,
> ...  QMessageBox.YesAll,QMessageBox.NoAll)
> (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
>
> >>> k = QMessageBox.question(None,'','',
>
> ...     QMessageBox.Yes,QMessageBox.No)
>
> >>> k, type(k)
>
> (3, <type 'int'>)
>
> >>> del a,k
>
> When I click "Yes" (the left-most button) it correctly returns 3
> (QMessageBox.Yes == 3) and when I close without choosing it again
> correctly returns 0 (QMessageBox.NoButton == 0). So it all seems to
> work okay for me. As of qt 3.3.4, the question-mark icon is still
> missing, though :-(
>
> HTH
>
> John Ridley
>
>
>
>
>
> ___________________________________________________________
> Yahoo! Messenger - want a free and easy way to contact your friends online?
> http://uk.messenger.yahoo.com
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list