I want to create an app, where the user will decide it the main window will stay always on top of the other apps.
In PyQt4 it is easy to create a window that will stay a
Rosh is correct. But don't forget to include window.show() after you change the flag. Your window will be hidden when the flag is changed. I have also included the code for toggling the flag.
This will clear it:
window.setWindowFlags(window.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
This will enable it:
window.setWindowFlags(window.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
This will toggle it:
window.setWindowFlags(window.windowFlags() ^ QtCore.Qt.WindowStaysOnTopHint)