Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyqt4: Open website in standard browser on button click

I would like to open website in standard browser of operating system when user clicks a button in my pyqt4 application. How can I do this?

like image 692
PocketSam Avatar asked Sep 10 '10 13:09

PocketSam


1 Answers

You can also use QDesktopServices::openUrl.

Here's the minimal working example,

from PyQt5.Qt import QApplication, QUrl, QDesktopServices
import sys

app = QApplication(sys.argv)
url = QUrl("https://stackoverflow.com/questions/3684857/pyqt4-open-website-in-standard-browser-on-button-click")
QDesktopServices.openUrl(url)
like image 93
Coiby Avatar answered Sep 29 '22 12:09

Coiby