Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a transparent main window

Tags:

python

qt

pyqt

How to set main window background transparent on QT? Do I need an attribute or a style?
I've tried setting the opacity, but it didn't work for me.

app.setStyleSheet("QMainWindow {opacity:0}")
like image 437
punisher Avatar asked Feb 18 '13 18:02

punisher


People also ask

How do I make my window screen transparent?

You can press the shortcut (ALT+A, which is changeable by clicking the toolbar icon) or you can hover your mouse over the top of a window and click the down arrow that appears, then select "Opacity." WindowTop also has the click-through feature that Peek Through has.

How do I make full screen start transparent?

Increase Windows 10 Start Menu Transparency First, use the keyboard shortcut Windows Key + R and type: regedit and hit Enter or click OK. From there, double click on EnableTransparency and change its value from 1 to 0 and click OK. No restart is required.

Can you make windows transparent in Windows 10?

To Turn On or Off Transparency Effects in Windows 10,Navigate to Personalization > Colors on the left. Turn off or on the toggle option Transparency effects in the right page. You are done.


1 Answers

you must set new attribute for MainWindow object as below:

class Main(QtGui.QMainWindow):
      def __init__(self):
          self.setAttribute(Qt.WA_TranslucentBackground)
like image 102
omid Avatar answered Oct 12 '22 23:10

omid