pyqt5制作的小巧玲珑的计算器
废话不多说,本程序为练手作,如果有哪里有不足的,还请各位大佬指出!实物图和代码如下:
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import Qt
import PyQt5.QtCore as QtCore
import sys
class Btn(QPushButton):
def __init__(self, name, line):
super().__init__(name)
self.name = name
self.line = line
def normal_action(self):
string = self.line.text()
if self.name == '^':
self.line.setText(string + '**')
else:
self.line.setText(string + self.name)
def back_action(self):
string = self.line.text()[:-1]
self.line.setText(string)
def del_action<