Python GUI class structure calls
<p>Let's say for example I have two classes, <code>A</code> and <code>B</code>.</p>

<p>Class <code>A</code> is the one I called <code>class main</code> and <code>B</code> is a <code>GUI</code> class(lets say its called <code>class main_gui</code>).</p>

<p>GUI class contains method that initiates and sets all views, buttons and stuff called <code>setupUi</code>. Class is generated by <code>QtCreator</code>.</p>

<p>What else must my class have to make it sufficient to run <code>B</code> by itself or be called from other classes? I know that calling <code>__init__</code> is not mandatory but its a good idea. What must this function contain? Is <code>__main__</code> mandatory to make it runnable? </p>

<p>What must <code>__main__</code> contain? What must the constructor contain? I am stuck on calling classes and I can't find simple enough explanation or a simple enough sample code that i can implement in my case. Please explain for braindead human.       </p>

<p>I am a Java developer but i am new in Python and its specifics. If it is possible to provide with some code samples (even pseudocode will do) you will be very helpful. Thanks in advance! </p>

<p>not sure if this is what your are looking for but :</p>

<p>A simple view :</p>

<pre><code>class Home(QtWidgets.QFrame, Ui_home):
"""Home view."""

def __init__(self, parent=None):
    """Initializer."""
    super(Home, self).__init__()
    self._parent = parent
    self.setupUi(self)
</code></pre>

<p>Ui_home is the QtDesigner generated class </p>

<p>in my main i just create a QApplication and exec it :</p>

<pre><code>app = QtWidgets.QApplication(sys.argv)
</code></pre>

<p>Then i can call my home_controller or just create a home display my view:</p>

<pre><code>home = Home()
sys.exit(app.exec_())
</code></pre>

<p>Obviously this is a very simple exemple in a real app, you would have a class to handle the controller/ view creation but, this is as simple as that</p>

python qt python-3.x pyqt qt-creator