Moved widget creation

Moved widget creation in the main window from the __init__ function to
its own function.