It's good practice to have your GUI and Logic in separate files instead of all one file. It keeps the code cleaner.

Take a look at any of the frontends such as "record", "configtool", "talkeditor" etc... for examples. You should see that all the GUI drawing is done in it's own file, and then the logic that makes the GUI function is done in a separate file.