Can the gui element be implemented inside trial loop?

A window in fullscreen mode wouldn’t be fullscreen if other windows could be displayed in front of it (and receive move and keyboard events). You need to actively minimise your main window to allow another one be seen and interacted with. Read this thread (despite the title, this is not a bug):