Skip to content

Python3 - QT_QPA_PLATFORM

Python3
  • Nach meinem Umzug auf Ubuntu 21.04 hatte ich doch mit meinem VSCodium ein kleines Problem, was aber nervte 🙂 Hier ein Bild.

    Problem.jpeg

    Links ist mein Restic UI, wenn ich es aus dem Ordner aufrufe. Rechts der Aufruf aus VSCodium heraus. Wie man sieht, passt das "Design" nicht. Ich habe jetzt bestimmt zwei Tage ziemlich viel gelesen und ausprobiert und nichts funktionierte 😞 Ja, so was kommt vor. Aber auch auf einen kleinen Hilferuf bei Twitter meldete sich leider niemand. Also musste ich das selber lösen. Also heute noch mal ran an die Sache.

    Kurze Erklärung,. Auf meinem Linux Mint Cinnamon (X-System) hatte ich keinerlei Probleme. So mit war ich mir relativ sicher, das es irgendwas mit Wayland zu tuen hatte, aber was !? Die heutige Internetrecherche brachte mich dann auf diese Seite.

    Dort stolperte ich über das hier

    $QT_QPA_PLATFORM

    This controls how Qt apps run. It can be set to xcb for X11 or wayland-egl for Wayland.

    Über dieses QT_QPA_PLATFORM war ich schon öfter gestolpert, aber das stand immer was anderes und nichts funktionierte. Hier stand mal was anderes und zwar xcb und wayland-egl.

    wayland-egl getestet mit

    export QT_QPA_PLATFORM=wayland-egl
    

    Also, in VSCodium ein Terminal aufgemacht und dort eingegeben. Danach das Programm gestartet. Nix, immer noch nackig. Also testen wir das andere.

    export QT_QPA_PLATFORM=xcb
    

    Und zack, das Fenster sieht so aus wie es auf Ubuntu 21.04 der Standard ist.

    373375aa-f1a6-4f35-91bb-b81ec1a4fa11-grafik.png

    Ok, so weit war ich erst mal zufrieden. Das ist aber nur eine temporäre Lösung, weil nach einem Neustart usw. ist das wieder weg. Aber, auch dafür gibt es eine einfache Lösung. Wir editieren unser Profil.

    frank@frank-MS-XXXX:~/Downloads$ nano ~/.profile
    

    In diese Datei fügen wir ans Ende diese Zeile hinzu.

    # This controls how Qt apps run. It can be set to xcb for X11 or wayland-egl for Wayland.
    export QT_QPA_PLATFORM=xcb
    

    Abspeichern - Fertig! Nun startet das PyQt5 Programm mit dem richtigen "Design".

    Frank wieder glücklich 🤓

  • Nachdem ich ja mittlerweile schon lange weder auf Cinnamon bin, hatte ich nach einem Update von VSCodium wieder ein anderes Design. Ok, schauen wir rein.

    (venv) frank@frank-MS-7C37:~/restic-ui-public$ env | grep "QT"
    QT_ACCESSIBILITY=1
    QT_QPA_PLATFORMTHEME=qt5ct
    

    Wenn ich das auf

    QT_QPA_PLATFORMTHEME=gnome3
    

    ändere, sieht es wie auf meinem Linux Mint Cinnamon Desktop aus.

  • Python - Match-Case Statement

    Python3
    1
    0 Stimmen
    1 Beiträge
    83 Aufrufe
    Niemand hat geantwortet
  • Python - mehrsprachiges GUI

    Python3
    1
    0 Stimmen
    1 Beiträge
    119 Aufrufe
    Niemand hat geantwortet
  • Restic UI - Documentation

    Restic UI
    1
    0 Stimmen
    1 Beiträge
    206 Aufrufe
    Niemand hat geantwortet
  • Python3 - String-Operatoren

    Python3
    1
    0 Stimmen
    1 Beiträge
    134 Aufrufe
    Niemand hat geantwortet
  • Python3 - virtuelle Entwicklungsumgebung

    Angeheftet Python3
    3
    0 Stimmen
    3 Beiträge
    301 Aufrufe
    FrankMF

    Nach Systemwechsel erneut Probleme. Hier noch mal aufgelistet.

    Aufpassen, das kein venv Ordner vorhanden ist! Neu anlegen!

    python3 -m venv venv

    Dann meckert mein Linux Mint Cinnamon

    The virtual environment was not created successfully because ensurepip is not available. On Debian/Ubuntu systems, you need to install the python3-venv package using the following command. apt install python3.8-venv You may need to use sudo with that command. After installing the python3-venv package, recreate your virtual environment. Failing command: ['/home/frank/Restic_UI_Produktiv/restic-ui-public/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

    Ok, das ist einfach 😉

    apt install python3.8-venv python3 -m venv venv

    Danach aktivieren

    source venv/bin/activate Installation von PyQt5 (venv) frank@frank-MS-7C37:~/Restic_UI_Produktiv/restic-ui-public$ pip3 install PyQt5 Collecting PyQt5 Downloading PyQt5-5.15.4-cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl (8.3 MB) |████████████████████████████████| 8.3 MB 1.7 MB/s Collecting PyQt5-Qt5>=5.15 Downloading PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB) |████████████████████████████████| 59.9 MB 18.3 MB/s Collecting PyQt5-sip<13,>=12.8 Downloading PyQt5_sip-12.9.0-cp38-cp38-manylinux1_x86_64.whl (332 kB) |████████████████████████████████| 332 kB 46.1 MB/s Installing collected packages: PyQt5-Qt5, PyQt5-sip, PyQt5 Successfully installed PyQt5-5.15.4 PyQt5-Qt5-5.15.2 PyQt5-sip-12.9.0

    Danach meckert er über ein fehlendes Modul requests

    (venv) frank@frank-MS-7C37:~/Restic_UI_Produktiv/restic-ui-public$ python3 restic_ui.py Traceback (most recent call last): File "restic_ui.py", line 41, in <module> from functions import ( File "/home/frank/Restic_UI_Produktiv/restic-ui-public/functions.py", line 19, in <module> import requests as req ModuleNotFoundError: No module named 'requests' Installation requests (venv) frank@frank-MS-7C37:~/Restic_UI_Produktiv/restic-ui-public$ pip3 install requests Collecting requests Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB) |████████████████████████████████| 61 kB 802 kB/s Collecting chardet<5,>=3.0.2 Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB) |████████████████████████████████| 178 kB 2.7 MB/s Collecting certifi>=2017.4.17 Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB) |████████████████████████████████| 145 kB 14.0 MB/s Collecting idna<3,>=2.5 Downloading idna-2.10-py2.py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 9.4 MB/s Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB) |████████████████████████████████| 138 kB 11.5 MB/s Installing collected packages: chardet, certifi, idna, urllib3, requests Successfully installed certifi-2021.5.30 chardet-4.0.0 idna-2.10 requests-2.25.1 urllib3-1.26.6

    Und schwupps, geht mein Tool wieder 🙂

    4968ce42-7c66-4c8a-a2ad-424b9a529d87-grafik.png

  • Python3 - subprocess.Popen

    Python3
    1
    0 Stimmen
    1 Beiträge
    228 Aufrufe
    Niemand hat geantwortet
  • Wichtige Links

    Angeheftet Python3
    1
    0 Stimmen
    1 Beiträge
    170 Aufrufe
    Niemand hat geantwortet
  • Python und GUI

    Verschoben Python3
    1
    0 Stimmen
    1 Beiträge
    155 Aufrufe
    Niemand hat geantwortet