Port C++ class to PyQt
Question: I am trying to convert a Qt4 custom widget written in C++ to a Python 2.7
custom widget. However, I have not been able to figure out how
`QLabel(parent)` would be written in Python. This is the original C++ code
from the ".ccp" file:

    
    
    DocumentWidget::DocumentWidget(QWidget *parent)
        : QLabel(parent)
    {
        currentPage = -1;
        setAlignment(Qt::AlignCenter);
    }
    

The `QLabel(parent)` seems to be some sort of initializer list. I've tried
using multiple inheritance in Python in parallel, but this leads to the
following error: `Cannot create a consistent method resolution order (MRO) for
bases QLabel, QWidget`.

I'm trying to port the code instead of creating a wrapper for the C++ widget,
because I don't know C++ and think I will have to customize the widget further
in the future.

I'm not trained as a programmer and this is the first day I ran into C++, so
feel free to correct me even if I'm doing something silly. I will not feel
embarrassed.


Answer: The code defines a constructor for the `DocumentWidget` class, which inherits
`QLabel` and requires a `QWidget` as parent.

The equivalent PyQt code would be:

    
    
    from PyQt4 import QtCore, QtGui
    
    class DocumentWidget(QtGui.QLabel):
        def __init__(self, parent):
            super(DocumentWidget, self).__init__(parent)
            # or QtGui.QLabel.__init__(self, parent)
            self.currentPage = -1
            self.setAlignment(QtCore.Qt.AlignCenter)
    

