How it works...

In the preceding code, in the callMultilevelInheritance.pyw file, you can see that a class is defined called Student. The Student class includes two class variables called name and code, along with the following three methods:

  • __init__(): It is a constructor that takes the mandatory self parameter and two parameters, code, and name, that will be used to initialize the two class variables code and name
  • getCode(): This method simply returns the value in the code class variable
  • getName(): This method simply returns the value in the name class variable

The Marks class inherits the Student class. Consequently, an instance of the Marks class will not only be able to access its own members, but also those of the Student class. ...

Get Python GUI Programming - A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.