title: Transparent Background for Stacked Widgets in PyQt5
body: <p>I've been trying to create a basic clock using PyQt5. The clock part works and the background image behind the clock loads but I am unable to get the background of the text to be transparent. </p>
  
  <p>I have tried both the way listed below and also with <code>self.lbl1.setStyleSheet("background-color: rgba(255, 255, 255, 10);")</code> but I get the same result in both cases.</p>
  
  <p>If I set the <code>layout.setCurrentIndex(0)</code> I see that the background jpeg is there so that is loading just fine. </p>
  
  <p>Any thoughts on what I would need to do to have layered widgets with transparency?</p>
  
  <p>To try to clear it up a bit</p>
  
  <p>Here is what I get</p>
  
  <p><img src="https://i.stack.imgur.com/K32Lr.jpg" alt=""></p>
  
  <p>here is what I want</p>
  
  <p><img src="https://i.stack.imgur.com/KqVCe.jpg" alt=""></p>
  
  <pre><code>import sys
  from PyQt5.QtWidgets import *
  from PyQt5.QtGui import *
  from PyQt5.QtCore import *
  
  class Example(QWidget):
      def __init__(self):
          super().__init__()
          self.initUI()
  
      def initUI(self):
          layout = QStackedLayout()
  
  
          #Background area test
          self.background = QLabel(self)
          self.background.setPixmap(QPixmap("image.jpeg"))
          self.background.show()
          #self.background.setAutoFillBackground(True)
  
          #Setup text area for clock
          newfont = QFont("Consolas",120, QFont.Bold)
          self.lbl1 = QLabel()
          self.lbl1.setAlignment(Qt.AlignCenter)
          self.lbl1.setFont(newfont)
          self.lbl1.setWindowFlags(Qt.FramelessWindowHint)
          self.lbl1.setAttribute(Qt.WA_TranslucentBackground)
  
          #Timer to refresh clock
          timer = QTimer(self)
          timer.timeout.connect(self.showTime)
          timer.start(1000)
          self.showTime()
  
  
  
          #layout area for widgets
  
          layout.addWidget(self.background)
          layout.addWidget(self.lbl1)
          layout.setCurrentIndex(1)
          self.setLayout(layout)
          self.setGeometry(300,300,250,150)
          self.show()
  
      def showTime(self):
          time = QTime.currentTime()
          text = time.toString('hh:mm')
          if (time.second() % 2) == 0:
              text = text[:2] + ' ' + text[3:]
          self.lbl1.setText(text)
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())
  </code></pre>