ZHCai 307945b3ab
Update 03-类的继承关系.py
按照注释的意思, 此处应该是修改为subclass
2023-09-28 16:53:29 +08:00

14 lines
400 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from PySide6 import QtWidgets
def get_sub_classes(class_):
"""递归地显示某一类的所有子类"""
for subclass in class_.__subclasses__():
print(subclass)
if len(subclass.__subclasses__()) > 0:
get_sub_classes(subclass)
# 查看QAbstractButton抽象基类的所有子类了解Qt6提供了哪些按钮控件
get_sub_classes(QtWidgets.QAbstractButton)