-
QWidget is the base class for all user interface objects or widgets.
-
QGridLayout 中的参数,前两个:row,col
后两个:rowSpan,columnSpan -
FormLayout
layout.addRow('Name:', QLineEdit())
- If your slot function needs to receive extra arguments, then you can pass them in by using functools.partial. For example, you can modify greeting() as follows:
def greeting(who):
"""Slot function."""
if msg.text():
msg.setText('')
else:
msg.setText(f'Hello {who}')
btn.clicked.connect(functools.partial(greeting, 'World!'))
- You can’t create a main window without first setting a central widget. You must have a central widget, even if it’s just a placeholder.