• 大小: 7KB
    文件类型: .py
    金币: 2
    下载: 1 次
    发布日期: 2021-06-05
  • 语言: Python
  • 标签: 计算器  pyqt5  

资源简介

使用ui文件生成的计算器界面源码,对每个按钮的点击事件做了定义

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file ‘calc.ui‘
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore QtGui QtWidgets

class Ui_MainWindow(object):
    def setupUi(self MainWindow):
        MainWindow.setobjectName(“MainWindow“)
        MainWindow.resize(420 332)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setobjectName(“centralwidget“)
        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(30 39 322 161))
        self.verticalLayoutWidget.setobjectName(“verticalLayoutWidget“)
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(0 0 0 0)
        self.verticalLayout.setobjectName(“verticalLayout“)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setobjectName(“gridLayout“)
        self.pushButton_13 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_13.setobjectName(“pushButton_13“)
        self.gridLayout.addWidget(self.pushButton_13 4 0 1 1)
        self.pushButton_16 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_16.setobjectName(“pushButton_16“)
        self.gridLayout.addWidget(self.pushButton_16 4 3 1 1)
        self.pushButton = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton.setobjectName(“pushButton“)
        self.gridLayout.addWidget(self.pushButton 2 3 1 1)
        self.pushButton_2 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_2.setobjectName(“pushButton_2“)
        self.gridLayout.addWidget(self.pushButton_2 2 2 1 1)
        self.pushButton_3 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_3.setobjectName(“pushButton_3“)
        self.gridLayout.addWidget(self.pushButton_3 2 1 1 1)
        self.pushButton_14 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_14.setobjectName(“pushButton_14“)
        self.gridLayout.addWidget(self.pushButton_14 4 1 1 1)
        self.pushButton_15 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_15.setobjectName(“pushButton_15“)
        self.gridLayout.addWidget(self.pushButton_15 4 2 1 1)
        self.pushButton_12 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_12.setobjectName(“pushButton_12“)
        self.gridLayout.addWidget(self.pushButton_12 1 3 1 1)
        self.pushButton_4 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_4.setobjectName(“pushButton_4“)
        self.gridLayout.addWidget(self.pushButton_4 2 0 1 1)
        self.pushButton_5 = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.pushButton_5.setobjectName(“pushButton_

评论

共有 条评论