How to install a simple web browser

Revision as of 15:29, 27 November 2020 by Registered User

A simple web browser based on QT5 technologies could be easily installed using the package repository for OpenSTLinux distribution service.

2 solutions exists:

  • QT application
  • QT python application

1. qt-wpe-simple-browser[edit source]

 apt-get update
 apt-get install qt-wpe-simple-browser

2. python3-pyqt5[edit source]

 apt-get update
 apt-get install python3-pyqt5
# web_browser.py
# Copyright (c) STMicroelectronics
# License: BSD-3-Clause
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebKitWidgets import *

import sys

class MainWindow(QMainWindow):

    def __init__(self, *args, **kwargs):
        super(MainWindow,self).__init__(*args, **kwargs)

        self.setWindowTitle(sys.argv[1])
        self.browser = QWebView()
        self.browser.setUrl( QUrl(sys.argv[1]) )
        self.setCentralWidget(self.browser)
        self.show()

QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
app = QApplication(sys.argv)
window = MainWindow()
app.exec_()

3. Display the web browser on HDMI display[edit source]

4. Display patform[edit source]

4.1. eglfs[edit source]

4.2. wayland[edit source]

  • Install qtwayland
 apt-get install qtwayland
  • Set wayland egl as display platform
 export QT_QPA_PLATFORM=wayland-egl
  • launch the python web browser
 python3 web_browser.py http://www.google.fr


For a better user experience, displaying the web browser on a