Subclassing

This is a short tutorial on how to create your own classes, inherit from pyqt classes or from your own classes. Black Adder provides you a rapid method to create a complex class implementation. The Project and Classes panels allow you to quickly navigate through the resulting code.

Step 1:
Now you can try to create your own class from the QWidget pyqt classs. We will reimplement closeEvent() for our purposes.

Step 2:
If we open the file aclass.py in the project panel you will see the following:

Step 3:
Repeat the subclassing step but this time from the class QFrame and reimplemnt one function from QFrame.

Step 4:
If we open the file bclass.py in the project panel you will see the following:

Step 5:
Note that BlackAddre will allow you to sub-class your own classes. If you try to create a new class Cclass you will see that you can select Bclass as parent and reimplement its functions.

Step 6:
And finally you will have the following structure of classes:


© theKompany.com, Inc 2002-2003