Python Forum

Full Version: top level window
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to write a code to test a device
but I need my top level window always be at full display, can't be minimized, can't be re-sized
can't be closed
is that possible?
regards
What you're describing is typically called "kiosk mode". It's commonly used in libraries, or at restaurants for placing orders/displaying menus. If your app is web based, you can simply pass the --kiosk flag to chromium. https://www.danpurdy.co.uk/web-developme...-tutorial/

If you're not web-based, it's also possible. But the flags you need to use will obviously be different depending on which gui toolkit you use.
Basic example for PyQt5. You can also replace the image background by a solid color with QtGui.QPalette.

#!/usr/bin/python3
import sys
from PyQt5 import QtCore, QtGui, QtWidgets

class Main(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        desktop = app.desktop().screenGeometry()
        pixmap = QtGui.QPixmap('background.png')
        pixmap = pixmap.scaled(desktop.width(), desktop.height())
        self.splash = QtWidgets.QSplashScreen(pixmap)
        self.splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint)
        self.splash.setCursor(QtCore.Qt.BlankCursor)
        self.splash.showFullScreen()


if __name__== '__main__':
    app = QtWidgets.QApplication([])
    gui = Main()
    sys.exit(app.exec_())
(Oct-15-2018, 07:44 PM)nilamo Wrote: [ -> ]What you're describing is typically called "kiosk mode". It's commonly used in libraries, or at restaurants for placing orders/displaying menus. If your app is web based, you can simply pass the --kiosk flag to chromium. https://www.danpurdy.co.uk/web-developme...-tutorial/

If you're not web-based, it's also possible. But the flags you need to use will obviously be different depending on which gui toolkit you use.

> I was out of the country, will check this kiosk mode and let you know my progress.
thanks for your help