I have the following skeleton code:
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QToolTip, QMainWindow, QTextEdit
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import Qt
class Editor(QMainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.initUI()
# --------------------------------------
def initMenubar(self):
menubar = self.menuBar()
fileMenuBtn = menubar.addMenu("File")
editMenuBtn = menubar.addMenu("Edit")
viewMenuBtn = menubar.addMenu("View")
# --------------------------------------
def initToolbars(self):
self.toolbar = self.addToolBar("Options")
# Makes the next toolbar appear underneath this one
self.addToolBarBreak()
self.formatbar = self.addToolBar("Format")
# --------------------------------------
def initUI(self):
QToolTip.setFont(QFont('Monospace', 10))
self.setToolTip('<b>Proofor</b> main window')
#self.text = QTextEdit(self)
#self.setCentralWidget(self.text)
# Initialize a statusbar for the window
self.statusbar = self.statusBar()
self.initToolbars()
self.initMenubar()
self.setWindowTitle('Proofor - proof editor')
#self.setWindowIcon(QIcon('dots.png'))
#self.setGeometry(100, 100, 500, 500)
# ================================================
def main():
app = QApplication(sys.argv)
main = Editor()
main.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
If run this code as is (python editor.py), then everything works okay. However, if I un-comment the lines that add a QTextEdit widget, in initUI, I get the following warnings appearing:
(python:1949): Gtk-CRITICAL **: IA__gtk_widget_style_get: assertion 'GTK_IS_WIDGET (widget)' failed
QWidget::setMinimumSize: (/Editor) The largest allowed size is (16777215,16777215)
The window that would otherwise pop-up doesn't, but I can still close up the application. Instead, if in main I have main.showMaximized() rather than main.show(), I cause my computer to crash. This does not happen if I don't have a QTextEdit widget set as the central widget, since otherwise, a normal, maximized window appears.
Any ideas regarding what's happening?
edit for posterity: issue was occurring within my Anaconda Python distribution, I had installed pyqt5 which was conflicting with the native pyqt4.