base python code for gui control