[New-bugs-announce] [issue46135] Changing a label's text is not working properly on transparent widgets

MB SANTALU report at bugs.python.org
Sun Dec 19 16:23:41 EST 2021


New submission from MB SANTALU <mbsantalu at gmail.com>:

Updating a label's text on a transparent widget in MacOS behaves strangely, previous text remains partially visible (see screenshot)

System Specs: MacOS Monterey 12.0.1 and Python 3.10

Code:

import sys
from PyQt6 import QtWidgets, QtCore
from PyQt6.QtCore import QTimer
from PyQt6.QtGui import QFont
from PyQt6.QtWidgets import QLabel, QFrame
def update_label():
    l1.setText("Bye!")
    l1.update()
    window.repaint()
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget()
window.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)
window.setWindowFlag(QtCore.Qt.WindowType.FramelessWindowHint)
window.setFixedSize(800, 600)
font = QFont()
font.setPointSize(72)
l1 = QLabel(window)
l1.setText("Hello World")
l1.setFont(font)
l1.setStyleSheet("color:red")
window.show()
timer = QTimer()
timer.setInterval(1000)
timer.timeout.connect(update_label)
timer.start()
app.exec()

----------
components: macOS
files: sof.png
messages: 408931
nosy: mbsantalu, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Changing a label's text is not working properly on transparent widgets
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50503/sof.png

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46135>
_______________________________________


More information about the New-bugs-announce mailing list