A PyQt6 working example of the solution as described by directedition.
Qt.WindowType.FramelessWindowHint
produces a borderless window, doc.
Notice that it can be either passed as flags
argument in the constructor or fixed in a second moment with setWindowFlags
showFullScreen()
shows the widget in full-screen mode, doc
import sys
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QImage
from PyQt6.QtWidgets import QApplication, QMainWindow
class Img(QMainWindow):
def __init__(self, img_path, parent=None):
super().__init__(parent)
self.qimg = QImage(img_path)
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
def paintEvent(self, qpaint_event):
# event handler of QWidget triggered when, for ex, painting on the widget’s background.
painter = QPainter(self)
rect = qpaint_event.rect() # Returns the rectangle that needs to be updated
painter.drawImage(rect, self.qimg)
self.showFullScreen()
if __name__ == "__main__":
app = QApplication(sys.argv)
img_path = # add path of the image
window = Img(img_path)
window.show()
sys.exit(app.exec())