[PyQt] QMessagebox in slot terminates application

Darryl Wallace darryl.wallace at prosensus.ca
Mon Jan 12 16:50:39 GMT 2009


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


More information about the PyQt mailing list