This is happening because Google Colab and Jupyter run on virtual environments which do not support GUI outputs as you cannot open new windows through a browser.
Running it locally on a code editor(Spyder, or even IDLE) ensures that it can open a new window for the GUI to initialize.
For coding the GUI it is best to do it locally on a full-fledged code editor.