From 3d1da5e5572d030411f7aba3adb67197dd807f64 Mon Sep 17 00:00:00 2001 From: lt Date: Mon, 17 Apr 2023 23:53:28 +0800 Subject: [PATCH] pyqt5 image support chinese language. --- default/Dockerfile | 4 ++-- default/hello.py | 2 +- qml/Dockerfile | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/default/Dockerfile b/default/Dockerfile index bbd6c86..3f79735 100644 --- a/default/Dockerfile +++ b/default/Dockerfile @@ -10,7 +10,7 @@ RUN adduser --quiet --disabled-password qtuser && usermod -a -G audio qtuser # This fix: libGL error: No matching fbConfigs or visuals found ENV LIBGL_ALWAYS_INDIRECT=1 -# Install Python 3, PyQt5 -RUN apt-get update && apt-get install -y python3-pyqt5 +# Install Python 3, PyQt5, chinese fonts support +RUN apt-get update && apt-get install -y python3-pyqt5 fonts-wqy-zenhei COPY hello.py /tmp/hello.py diff --git a/default/hello.py b/default/hello.py index be9b5e0..7e7bdea 100644 --- a/default/hello.py +++ b/default/hello.py @@ -11,7 +11,7 @@ w.setWindowTitle("My First Qt App") # Add a label with tooltip - label = QLabel("Hello World", w) + label = QLabel("Hello World\n你好 世界", w) label.setToolTip("This is a QLabel widget with Tooltip") label.resize(label.sizeHint()) label.move(80, 50) diff --git a/qml/Dockerfile b/qml/Dockerfile index 526b44f..5144960 100644 --- a/qml/Dockerfile +++ b/qml/Dockerfile @@ -37,6 +37,7 @@ RUN apt-get update && apt-get install -y \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-ugly \ alsa-base \ - alsa-utils + alsa-utils \ + fonts-wqy-zenhei COPY hello.* /tmp/