Python Forum
top level window - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: top level window (/thread-13444.html)



top level window - juliolop - Oct-15-2018

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


RE: top level window - nilamo - Oct-15-2018

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-development/raspberry-pi-kiosk-screen-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.


RE: top level window - Alfalfa - Oct-21-2018

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_())



RE: top level window - juliolop - Nov-07-2018

(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-development/raspberry-pi-kiosk-screen-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