I'm also a Python beginner, so please take my words with a little pinch of salt, but I can at least explain the first problem.<div><br /></div><div>What does your fnQuit_button_clicked(self) code do? It *executes the application*, and when the application finishes, it quits with its return code. Not only that, but instead of an application, you're trying to execute a widget, which actually generates the error...</div><div><br /></div><div>Also, I'd say it's at least confusing that you're trying to instantiate your widget as a variable called "app", which is the source of confusion that led to this problem. And then you "run" the widget, which actually launches the application.</div><div><br /></div><div>I'd suggest to stick to the "normal" way of doing those things.</div><div><br /></div><div>First of all, change the three bottom lines to the following:</div><div><br /></div><div>myapp = QApplication(sys.argv) # Instantiate a QApplication</div><div>mywidget = LayoutExample() # Instantiate my widget</div><div>sys.exit(myapp._exec()) # Launch the application and exit with its return code</div><div><br /></div><div>Then, move self.show() to the constructor, and remove the run() function. The widget shows itself after it's constructed, and you don't "run" a widget.</div><div><br /></div><div>And finally, your Quit button should simply call self.close() . In this case, I would not even create a separate function for this; instead, I would simply connect the button directly to self.close (remember, without "()", since we are passing it and not executing it!). When this widget is closed, the application will exit.<br /><br />-- <br />darkpenguin</div>