For example:
> import PyQt5.QtGui as qt_gui
> import PyQt5.QtWidgets as qt_widgets
> import PyQt5.QtCore as qt_core
> import sys
>
> class Color(qt_widgets.QWidget):
> def __init__(self, color, *args,**kwargs):
> super(Color,self).__init__(*args,**kwargs)
> self.setAutoFillBackground(True)
>
> palette = self.palette()
> palette.setColor(qt_gui.QPalette.Window, qt_gui.QColor(color))
> self.setPalette(palette)
>
> class MainWindow(qt_widgets.QMainWindow):
> def __init__(self, *args, **kwargs):
> super(MainWindow, self).__init__(*args, **kwargs)
> self.setWindowTitle("TestApp")
> #label = qt_widgets.QLabel("Label")
> # label.setAlignment(qt_core.Qt.AlignCenter)
> * self.*
> layout = qt_widgets.QVBoxLayout()
> layout.addWidget(Color("white"))
> layout.addWidget(Color("blue"))
> layout.addWidget(Color("red"))
> widget = qt_widgets.QWidget()
> widget.setLayout(layout)
> # widget = Color("red")
> self.setCentralWidget(widget)
>
> app = qt_widgets.QApplication(sys.argv)
>
> window = MainWindow()
> window.show()
> app.exec_()
>
>
In my installation of the Spyder(3.3.3) auto-completion shows only "
__init__", and my installation of the Pycharm shows many methods from the
QMainWindow(the base class of my class) and QWidget(base class of QMainWindow).
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.