python - Pycharm doesn't show error information for `PyQt5` program (e.g. `TypeError`) -
in pycharm 4.5.2, if had error in pyqt5
slots, when slots called, pycharm shows process finished exit code 1
, not , why error happends. doesn't happen when error in __init__
.
makes difficult debug. how fix this?
this widget generated qt designer
for example, if wrote button.settext('a'+1)
when clicked on button:
# -*- coding: utf-8 -*- import sys pyqt5 import qt test import ui_form application = qt.qapplication(sys.argv) class mywidget(qt.qwidget): def __init__(self): super(mywidget, self).__init__() self.main = ui_form() self.main.setupui(self) # self.main.pushbutton.settext('a'+1) # prints `typeerror: can't convert 'int' object str implicitly ` self.show() self.main.pushbutton.clicked.connect(self.show_error) def show_error(self): self.main.pushbutton.settext('a'+1) # print "process finished exit code 1" when clicked on button, , crash. my_qt_program = mywidget() my_qt_program.show() sys.exit(application.exec_())
it works fine in windows console:
test.py(generated qt designer):
# -*- coding: utf-8 -*- # form implementation generated reading ui file 'test.ui' # # created by: pyqt5 ui code generator 5.5 # # warning! changes made in file lost! pyqt5 import qtcore, qtgui, qtwidgets class ui_form(object): def setupui(self, form): form.setobjectname("form") form.resize(115, 58) self.verticallayout = qtwidgets.qvboxlayout(form) self.verticallayout.setobjectname("verticallayout") self.pushbutton = qtwidgets.qpushbutton(form) self.pushbutton.setobjectname("pushbutton") self.verticallayout.addwidget(self.pushbutton) self.retranslateui(form) qtcore.qmetaobject.connectslotsbyname(form) def retranslateui(self, form): _translate = qtcore.qcoreapplication.translate form.setwindowtitle(_translate("form", "form")) self.pushbutton.settext(_translate("form", "show \'a\' +1"))
Comments
Post a Comment