Move frame resize into conditional statement so that it is only called when running in a GUI.