in reply to MessageBox before mainloop problem
I would just point out that it is possible to call MainLoop more than once in a program.
You could use the MainWindow for a message box, and call MainLoop.
When the user closes that window, MainLoop exits.
Then you can re-construct the MainWindow for the "main" app, and call MainLoop again.