在Pycharm 4.5.2中,如果我在PyQt5插槽中出错,那么当调用这些插槽时,Pycharm只显示Process finished with exit code 1,而不显示错误发生的位置和原因。当错误在__init__中时,不会发生这种情况。
这使得调试非常困难。我怎么解决这个问题?在
这个小部件是由Qt设计器生成的
例如,如果我在单击按钮时写入button.setText('a'+1):# -*- coding: utf-8 -*-
import sys
from PyQt5 import Qt
from 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 to str implicitly ` normally
self.show()
self.main.pushButton.clicked.connect(self.show_error)
def show_error(self):
<