A QtGui.QCheckBox is a widget that has two states: on and off. It is a box with a label. Check boxes are typically used to represent features in an application that can be enabled or disabled. #!/usr/bin/python # -*- coding: utf-8 -*- """ Z…
#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, a QtGui.QCheckBox widget is used to toggle the title of a window. author: Jan Bodnar website: zetcode.com last edited: September 2011 """ i…
复选框一共有三种状态:全选中.半选中和无选中.若一个父选项的子选项全部为选中状态,则该父选项为全选中:若子选项全部为无选中状态,则该父选项为无选中状态:若子选项既有全选中和无选中状态,则该父选项为半选中状态 import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QWidget, QCheckBox from PyQt5.QtGui import QIcon class Demo(QWidg…
一个QCheckBox会有2种状态:选中和为选中.它由一个选择框和一个label组成,常常用来表示应用的某些特性是启用或不启用. 在下面的例子中,我们创建了一个选择框,它的状态变化会引起窗口标题的变化. 示例的执行效果如下: #!/usr/bin/python3 # -*- coding: utf- -*- """ ZetCode PyQt5 tutorial In this example, a QCheckBox widget is used to toggle the…
The most universal layout class is the grid layout. This layout divides the space into rows and columns. To create a grid layout, we use the QtGui.QGridLayout class. #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui ""…
The QtGui.QBrush is an elementary graphics object. It is used to paint the background of graphics shapes, such as rectangles, ellipses, or polygons. A brush can be of three different types: a predefined brush, a gradient, or a texture pattern. #!/usr…
The QtGui.QPen is an elementary graphics object. It is used to draw lines, curves and outlines of rectangles, ellipses, polygons, or other shapes. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example we draw…