Link defined in QtLabel won't open external browser

206 views
Skip to first unread message

Jakob Kousholt

unread,
Mar 18, 2021, 10:34:55 AM3/18/21
to Python Programming for Autodesk Maya
Hey Everyone,

I am trying to link to an external website from my PyQt UI. Here's a simple example of what I have written:

link = QtWidgets.QLabel()
link.setTextFormat(QtCore.Qt.RichText)
link.setText("<a style='color:white;' href='https://www.google.com/' target='_blank'>Google Example</a>")

The link shows up just fine - including the styling. When I right click on the label, Qt offers me to copy the link location, so the link works, except when I click the link nothing happens. I would have loved to see chrome or firefox open up. Any ideas what I am missing? Thanks

Marcus Ottosson

unread,
Mar 18, 2021, 11:24:42 AM3/18/21
to python_in...@googlegroups.com
Just one piece of the puzzle missing.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/32a16d4c-476f-4868-b04a-7b4cf4445d98n%40googlegroups.com.

Jakob Kousholt

unread,
Mar 18, 2021, 11:47:18 AM3/18/21
to python_inside_maya

Marcus Ottosson

unread,
Mar 18, 2021, 12:23:07 PM3/18/21
to python_in...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages