[PyQt] QMessagebox in slot terminates application
Marc Nations
mnations.lists at gmail.com
Mon Jan 12 17:16:32 GMT 2009
Yeah, that's more correct. Since the MessageBox is being called indirectly
the actual value it returns isn't being utilized.
Although now I'm a little confused as to why the app is even returning a
value when the MessageBox is closed. Even if you take sys.exit() out and
just print out the value the app returns, it will still exit. Basically the
whole app acts like a DialogBox that gets triggered by the MessageBox.
I'm not sure I fully understand what all the exec() function does.
On Mon, Jan 12, 2009 at 10:50 AM, Darryl Wallace <
darryl.wallace at prosensus.ca> wrote:
>
> Marc Nations wrote:
>
>> Why are you calling the exec_() function from inside the sys.exit() call?
>>
>> From the way it's programmed, it looks like sys.exit() will execute and
>> hold until it gets a result back from the MessageBox called inside the tray
>> icon. At that point it's going to exit using the result as it's argument.
>> If you just select 'OK' then the MessageBox returns a 0, which will then
>> cause a normal termination the program (exit code 0).
>>
> Actually, if you click OK, message box returns 1024. Which is the value of
> the enum of StandardButton. So you're seeing normal termination, but if the
> Ok button were the result, then the exit code would be 1024. It will return
> the error code based on what the application returns, not the messagebox.
>
> darryl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090112/d3da340f/attachment.html
More information about the PyQt
mailing list