def build_layout(self): # external editor path self.edit_path = QtWidgets.QLineEdit() self.external_editor_label = QtWidgets.QLabel('External Editor Path') self.external_editor_label.setBuddy(self.edit_path) self.layout.addWidget(self.external_editor_label) self.layout.addWidget(self.edit_path) # # change editor colours self.choose_colour_button = QtWidgets.QPushButton('Choose Colour') self.colour_dialog = QtWidgets.QColorDialog() self.choose_colour_button.clicked.connect(self.colour_dialog.show) self.layout.addWidget(self.choose_colour_button) # change editor font self.font_size = QtWidgets.QSpinBox() self.font_size.setValue(9) self.font_size_label = QtWidgets.QLabel('Choose Font Size') self.font_size_label.setBuddy(self.font_size) self.layout.addWidget(self.font_size_label) self.layout.addWidget(self.font_size)
# exploratory testing from PythonEditor.ui.Qt import QtWidgets, QtGui, QtCore widgets = QtWidgets.QApplication.topLevelWidgets() ide = [w for w in widgets if w.objectName() == 'IDE'][0] ide.setStyleSheet('background:rgb(45,42,46);') @QtCore.Slot(QtGui.QColor) def info(colour): rgb = {'r': colour.red(), 'g': colour.green(), 'b': colour.blue()} ide.setStyleSheet('background:rgb({r},{g},{b});'.format(**rgb)) cd = QtWidgets.QColorDialog() cd.currentColorChanged.connect(info) cd.show() # cd.colorSelected.connect(info)