class ExampleWidget(QWidget): """ Example widget. Methods defined here should not be aware of spyder, but of the function required by the widget only. """ def __init__(self, parent): QWidget.__init__(self, parent=parent) self.setWindowTitle("Example") # Widgets self.button = QPushButton('Current editor') self.table = QTableWidget(self) # Widget setup self.button.setIcon(ima.icon('spyder')) # Layouts layout = QVBoxLayout() layout.addWidget(self.button) layout.addWidget(self.table) self.setLayout(layout) def msgbox(self, msg=None): """Message box.""" QMessageBox.information(self, 'Title', msg)