pytc-gui programming reference

pytc-gui is written using pyqt5.

Widget coding guidelines

class SomeWidget(QW.QWidget):
    """
    Do widget-y thing.
    """

    def __init__(self,parent,fit,*args,**kwargs):

        super().__init__()
        self._parent = parent
        self._fit = fit

        ## more stuff here

        self.layout()

    def layout(self):
        """
        Layout the widget.
        """

        self._main_layout = QW.QVBoxLayout(self)

        ## build layout here

    def update(self):
        """
        Update the widgets in some intelligent way.
        """

        pass

    def delete(self):
        """
        Delete the widget.
        """

        pass
  • self._parent is the parent widget to the current widget.
  • self._fit is the FitContainer instance created by the initial MainWindow instance and then passed to all other widgets. Accessing self._fit thus allows all of the widgets to synchronize their behavior.
  • layout is the main widget layout method.