[PyQt] QMessageBox, selectable text, different behaviour among OSes

Leonardo Corato leocor at gmail.com
Tue May 10 15:24:33 BST 2016


Hello everybody,

this is my first post. Pardon me whether it has aldready been asked.
I made a small program with PyQT (5) and the result is shown into a
QMessageBox.
In Windows I cannot select the text with the mouse while in Linux I can.

I suppose in Windows there's a different default that in Linux.
I saw there's an option in QT to force the text to be selectable, said mb
is the instance of QMessageBox
mb.setTextInteractionFlags(Qt::TextSelectableByMouse) but How can I apply
it in Python?

My snippet:
    def tagconvert(self):
        i = self.lineEdit.text()
        if len(i) >= 0 and i.isdigit():
            d = (int(i)).to_bytes(4, byteorder='little')
            converted = ''.join('%02x' % c for c in d)
            msg=QMessageBox()
            msg.setText(converted)
            msg.setWindowTitle("Tag Convertito:")
            msg.setTextInteractionFlags(TextSelectableByMouse);
            msg.exec_()
            print(converted)
        else:

Thanks and best regads,
Leo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160510/2e6be1d6/attachment.html>


More information about the PyQt mailing list