niubaobao_52 2021-03-21 15:11 采纳率: 0%
浏览 65

pyqy5子窗口的pushbutton报错

import time
from PyQt5.QtWidgets import *
from PyQt5 import QtCore,QtWidgets
from PyQt5.QtGui import *
import GUI,InformationGui,os
from functools import partial
from tkinter import *
import csv
#import dlib
import numpy as np
from skimage import io
import pandas as pd
#封装主界面
class firstwindow(QMainWindow,GUI.Ui_MainWindow):
    def __init__(self,parent = None):
        super().__init__(parent=parent)
        self.ui = GUI.Ui_MainWindow
        self.setupUi(self)
        self.pushButton_3.clicked.connect(self.convert)
        self.input = ''
        self.informationwin = information()
        self.show()

#自动识别按钮状态码,防止多点
        self.stateButton = 0
#信息同步
    def pushButton(self):
        print('0')
#自动识别
    def pushButton_2(self):
        self.stateButton = self.stateButton + 1
#信息采集
    def pushButton_4(self):
        print(1)
#安全教育
    def pushButton_5(self):
        print(2)
#输入信息
    def convert(self):
        self.input = self.lineEdit.text()
        f = open('tmp.txt', 'w', encoding='utf-8')
        f.write(str(self.input))
        f.close()
        self.informationwin .show1(self.input)


#信息窗口
class information(QDialog,InformationGui.Ui_Dialog):
    def __init__(self,parent = None):
        super(information,self).__init__()
        self.setupUi(self)
        self.i = 0
        self.data = pd.DataFrame(pd.read_excel("information.xlsx"))

    #获取照片
    def get_image(self,path):
        file = os.listdir(path)
        image = path + file[0]
        return image
    #姓名转换为ID
    def get_id(self):
        if self.input.isdigit() == FALSE:
            name = self.input
            if len(self.data.loc[self.data['姓名']==name])!=0:
                if self.i >= len(self.data.loc[self.data['姓名'] == name]):
                    self.i = 0
                result = self.data.loc[self.data['姓名'] == name]
                id_excel = str(result.iat[self.i,1])
                return id_excel
        else:
            id_excel = self.input
            return id_excel
    def pushButton_3(self):
        #self.i = self.i +1
        #self.show1()
        print(33)
    def show1(self,input):
        #获取输入信息
        self.input = input
        id = self.get_id()
        #根据ID搜索表格
        if len(self.data.loc[self.data['身份证'] == id] == 0):
            result = self.data.loc[self.data['身份证'] == id]
            id_excel = str(result.iat[0, 1])
            name = result.iat[0, 2]
            workplace = result.iat[0, 4]
            jobs = result.iat[0, 5]
            work_data = result.iat[0, 6]
            path = 'data/image/' + name + '/'
            if os.path.exists(path) == True:
                image_path = self.get_image('data/image/' + name + '/')
            else:
                image_path = '中金图标.jpg'
        else:
            name = '查无此人'
            workplace = ' '
            work_data = ''
            jobs = ''
            image_path = '中金图标.jpg'
        self.label.setPixmap(QPixmap(image_path))
        self.textBrowser.setText('姓名: ' + str(name))  # 修改姓名
        self.textBrowser_2.setText(str('部门: ' + str(workplace)))
        self.textBrowser_3.setText(str('上岗日期: ' + str(work_data)))
        self.textBrowser_4.setText(str('培训记录:'))
        self.textBrowser_5.setText(str('违章记录:'))
        self.textBrowser_6.setText(str('岗位: ' + str(jobs)))
        #按钮
        self.pushButton.clicked.connect(self.pushButton_3())
        #显示窗口
        self.exec()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    #informationwin = information()
    first = firstwindow()
    first.show()
    sys.exit(app.exec())

Traceback (most recent call last):
  File "D:/人员系统SVN/source code/-Personnel-information-management-system/the new code.py", line 44, in convert
    self.informationwin .show1(self.input)
  File "D:/人员系统SVN/source code/-Personnel-information-management-system/the new code.py", line 108, in show1
    self.pushButton.clicked.connect(self.pushButton_3())
TypeError: 'QPushButton' object is not callable

 

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-07 17:20
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证