[PyQt] 'clicked' parameter in QPushButton's constructor
Zhao Lee
redstone-cold at 163.com
Wed May 8 09:07:03 BST 2019
I can connect slot to QPushButton's clicked signal in its constructor this way
button = QPushButton("Click me",clicked=say_hello)
It worked ! Test example as following:
import sys
from PyQt5.QtWidgets import *
def say_hello():
print("Button clicked, Hello!")
# Create the Qt Application
app = QApplication(sys.argv)
# Create a button, connect it and show it
button = QPushButton("Click me",clicked=say_hello)
# button = QToolButton("Click me", clicked=say_hello)
# button.clicked.connect(say_hello)
button.show()
# Run the main Qt loop
app.exec_()
However , there seems no parameter named 'clicked' in QPushButton's constructor as described in the doc , what's the working mechanism behind ? How do I know which parameters I could pass to the constructor?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190508/5bc1a7b5/attachment.html>
More information about the PyQt
mailing list