[PyQt] How to make menubar transparent?

Souvik Dutta souvik.viksou at outlook.com
Sun Mar 1 14:39:00 GMT 2020


👍👍

On Sun, Mar 1, 2020, 7:30 PM Maurizio Berti <maurizio.berti at gmail.com>
wrote:

> Setting a transparent background through stylesheet should suffice:
>
> class MyWindow(QtWidgets.QMainWindow):
>     def __init__(self):
>         super().__init__()
>         # ...
>         self.setStyleSheet('''
>             QMenuBar {
>                 background: transparent;
>             }
>         ''')
>
>
> Il giorno dom 1 mar 2020 alle ore 02:23 Souvik Dutta <
> souvik.viksou at outlook.com> ha scritto:
>
>> I have a background and i want to see the background through the menubar.
>>
>> On Sun, 1 Mar, 2020, 3:44 am Maurizio Berti, <maurizio.berti at gmail.com>
>> wrote:
>>
>>> What do you mean by "transparent"?
>>> Do you want to see the background of the window or see "through" the
>>> window (desktop, other windows, etc)?
>>> In the first case, how did you set the background, and what type of
>>> background is that?
>>> Because if it's a plain color background (or a gradient), it *should* be
>>> ok, but you've to ensure that text of menu items has enough contrast,
>>> otherwise they wouldn't be readable.
>>> This aspect is mostly important if you want to follow the second
>>> approach, and I strongly advise you against it.
>>> Also, what operating system(s) is your program aimed for?
>>>
>>> Maurizio
>>>
>>> Il giorno sab 29 feb 2020 alle ore 17:45 Souvik Dutta Chowdhury <
>>> souvik.viksou at outlook.com> ha scritto:
>>>
>>>> The subject has it all.
>>>> _______________________________________________
>>>> PyQt mailing list    PyQt at riverbankcomputing.com
>>>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>>>
>>>
>>>
>>> --
>>> È difficile avere una convinzione precisa quando si parla delle ragioni
>>> del cuore. - "Sostiene Pereira", Antonio Tabucchi
>>> http://www.jidesk.net
>>>
>>
>
> --
> È difficile avere una convinzione precisa quando si parla delle ragioni
> del cuore. - "Sostiene Pereira", Antonio Tabucchi
> http://www.jidesk.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200301/3ffb7143/attachment.html>


More information about the PyQt mailing list