Python 3: PyQt: Make checkbox disabled + not grayed out + display tooltip -


the way found here: how make qcheckbox readonly, not grayed-out. this, however, disables mouse interactions control. need tooltip displayed when mouse on control. how can achieve this?

if i've understood correctly, you'd asking for, disabled checkbox showing tooltips:

 import sys  pyqt4 import qtgui, qtcore    class example(qtgui.qwidget):        def __init__(self):            super(example, self).__init__()            self.initui()        def initui(self):            self.cb = qtgui.qcheckbox('disabled checkbox showing tooltips', self)            self.cb.move(20, 20)            self.cb.toggle()            # self.cb.setenabled(false)            # self.cb.setstylesheet("color: black")            # self.cb.setattribute(qtcore.qt.wa_alwaysshowtooltips)            self.cb.settooltip ('my checkbox')            self.cb.toggled.connect(self.prevent_toggle)             self.setgeometry(300, 300, 250, 50)            self.setwindowtitle('qtgui.qcheckbox')            self.show()        def prevent_toggle(self):            self.cb.setchecked(qtcore.qt.checked)   def main():       app = qtgui.qapplication(sys.argv)       ex = example()       sys.exit(app.exec_())    if __name__ == '__main__':       main() 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -