[PyQt] Problems with PyQtWebEngine on Mac

Davide Liessi davide.liessi at gmail.com
Tue Feb 25 10:53:40 GMT 2020


Il giorno mar 25 feb 2020 alle ore 11:48 Davide Liessi
<davide.liessi at gmail.com> ha scritto:
> Consider the attached example: "test" is the main application,
> "app.py" is the py2app script, "build-app.sh" automates some manual
> steps (see later).

Maybe the attachments didn't survive: their content follows.
Sorry for the inconvenience.
Davide

---

test:

# minimal QWebEngine example.
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl
app = QApplication( [] )
view = QWebEngineView()
view.load( QUrl( "https://www.riverbankcomputing.com/software/pyqt/intro" ) )
view.show()
app.exec_()

---

app.py:

from setuptools import setup

setup(
    app = ['test'],
    name = 'test',
    setup_requires = ['py2app'],
)

---

build-app.sh:

#!/usr/bin/env bash

PYTHON="/opt/local/bin/python3.7"
QTROOT='/opt/local/libexec/qt5'

${PYTHON} app.py

APPBUNDLE=dist/test.app

rm ${APPBUNDLE}/Contents/Resources/qt.conf
mkdir -p ${APPBUNDLE}/Contents/PlugIns/platforms
cp ${QTROOT}/plugins/platforms/libqcocoa.dylib
${APPBUNDLE}/Contents/PlugIns/platforms/

${QTROOT}/bin/macdeployqt ${APPBUNDLE}

ln -s Versions/5/Helpers
${APPBUNDLE}/Contents/Frameworks/QtWebEngineCore.framework/Helpers
ln -s Versions/5/QtWebEngineCore
${APPBUNDLE}/Contents/Frameworks/QtWebEngineCore.framework/QtWebEngineCore
ln -s Versions/5/Resources
${APPBUNDLE}/Contents/Frameworks/QtWebEngineCore.framework/Resources


More information about the PyQt mailing list