I have an application which should open a web browser address after button click. Main function look like this:
class MainWindow(QtGui.QDialog):
def __init__( self, parent = None ):
super( MainWindow, self ).__init__( parent = parent )
self.button_layout = QtGui.QHBoxLayout(self)
self.webButton = PicButton(QtGui.QPixmap("images/button.png"))
self.filmButton.clicked.connect(openWebpage("http://some.web.adress"))
self.button_layout.addWidget(self.webButton)
And function for opening a web browser looks this way:
def openWebpage(address):
try:
import webbrowser
webbrowser.open(address)
except ImportError as exc:
sys.stderr.write("Error: failed to import settings module ({})".format(exc))
After running this code, no application window visible, web browser fires immediately, and console returns:
Failed to connect signal clicked().
Simple functions connected to this button works properly (for instance - printing text to console). Any ideas?