Example #1
0
    def initUI(self):

        self.setStyleSheet('''QToolTip { 
                           background-color: #8ad4ff; 
                           color: black; 
                           border: black solid 10px;
                           }

                        QWidget { 
                           background-color: white; 
                           color: black; 
                           
                           }

                           ''')

        QToolTip.setFont(QFont('Georgia', 11))
        
        pal = QPalette()
        pal.brightText()
        pal.setColor(QPalette.Background, QColor('#348ceb'))
        self.setPalette(pal)

        self.setToolTip('This is QWidget')

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('Styled QToolTip')

        self.vbox = QVBoxLayout()
        self.setLayout(self.vbox)

        self.x = QWidget()
        self.x.setStyleSheet("background-color:red;")
        self.x.resize(300,100)
        self.x.setToolTip("<img src = \"" + "logo1.png" + "\">")
        pprint.pprint(vars(QToolTip))
        # self.t = QToolTip("fa")

        # self.x.setToolTip(self.t)
        self.vbox.addWidget(self.x)
        
        self.show()
Example #2
0
 def _save_palette(self):
     """
     saves default color palette (normal mode) to retrieve it again, when once changed to dark theme
     """
     self.normal_theme = True
     default_palette = QPalette()
     # save all default entities as there seems to be no setStandard() method
     self.window_color = QPalette.window(default_palette).color()
     self.window_text_color = QPalette.windowText(default_palette).color()
     self.base_color = QPalette.base(default_palette).color()
     self.alternate_base_color = QPalette.alternateBase(
         default_palette).color()
     self.tool_tip_base_color = QPalette.toolTipBase(
         default_palette).color()
     self.tool_tip_text_color = QPalette.toolTipText(
         default_palette).color()
     self.text_color = QPalette.text(default_palette).color()
     self.button_color = QPalette.button(default_palette).color()
     self.button_text_color = QPalette.buttonText(default_palette).color()
     self.bright_text_color = QPalette.brightText(default_palette).color()
     self.link_color = QPalette.link(default_palette).color()
     self.highlight_color = QPalette.highlight(default_palette).color()
     self.highlighted_text_color = QPalette.highlightedText(
         default_palette).color()