def execute(self):
# Define this here to give users something to look at.
qApp = QApplication.instance()
self.expression = self.text()
try:
result = str(eval(str(self.expression)))
# Emit the result of the evaluated expression.
self.pythonOutput.emit(result)
# Clear the line edit, append the successful expression to the
# history, and update the current command index.
self.clear()
self.history.append(self.expression)
self.current = len(self.history)
except:
pass
评论列表
文章目录