Python+Qt桌面端与网页端人工客服沟通工具

这篇具有很好参考价值的文章主要介绍了Python+Qt桌面端与网页端人工客服沟通工具。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

程序示例精选

Python+Qt桌面端与网页端人工客服沟通工具

如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!

前言

这篇博客针对<<Python+Qt桌面端与网页端人工客服沟通工具>>编写代码,代码整洁,规则,易读。 学习与应用推荐首选。

功能:网页中如有用户询问留言,桌面端程序会及时收到网页传送的用户询问信息,以便得到客服及时查看回复。


文章目录

一、所需工具软件

二、使用步骤

        1. 引入库

        2. 代码实现

        3. 运行结果

三、在线协助

一、所需工具软件

1. Python, Qt

2. 数据库

二、使用步骤

1.引入库

import cv2
import sys
import os
import random
from mainWindow import Ui_MainWindow
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

2. 代码实现

代码如下:

# coding:utf-8
# import sys
#从转换的.py文件内调用类
import cv2
import sys
import os
import random
from mainWindow import Ui_MainWindow
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *


class myWin(QtWidgets.QMainWindow,Ui_MainWindow):
    def __init__(self):
        super(myWin, self).__init__()
        self.setupUi(self)

    #closeEvent2暂时不用
    def closeEvent2(self, event):
        self.box = QMessageBox(QMessageBox.Warning, "系统提示信息", "是否暂停摄像头?")
        qyes = self.box.addButton(self.tr("是"), QMessageBox.YesRole)
        qno = self.box.addButton(self.tr("否"), QMessageBox.NoRole)
        self.box.exec_()
        if self.box.clickedButton() == qyes:
            self.label.clear()
            while 1:
                if cv2.waitKey(1) == ord('q'):
                    break
            self.cap.release()
            cv2.destroyAllWindows()
        else:
            event.ignore()


    # # 退出系统窗口 X 绑定函数事件
    def closeEvent(self, event):
        # print("test")
        self.box = QMessageBox(QMessageBox.Warning, "系统提示信息", "是否退出系统?")
        qyes = self.box.addButton(self.tr("是"), QMessageBox.YesRole)
        qno = self.box.addButton(self.tr("否"), QMessageBox.NoRole)
        self.box.exec_()
        if self.box.clickedButton() == qyes:
            event.accept()
            QtWidgets.QWidget.closeEvent(self, event)
            sys.exit().accept()
        else:
            event.ignore()


    def videoRecog2(self):

        print("videoRecog2")
        global receiveID
        #receiveID = self.lineEdit.text()
        receiveID = "001"
        print("receiveID", receiveID)

        #得到receive信息*********************************************************
        # try:
        import sqlite3
        import datetime
        from datetime import datetime
        conn = sqlite3.connect("record.db", check_same_thread=False)
        curr = conn.cursor()
        curr.execute('select name from record where id="' + receiveID + '"')
        result2 = curr.fetchall()
        print("result2:", result2)
        curr.execute('select receive from record where id="' + receiveID + '"')
        result3 = curr.fetchall()
        print("result3:", result3)
        curr.execute('select record_time_receive from record where id="' + receiveID + '"')
        result4 = curr.fetchall()
        print("result4:", result4)
        curr.execute('select receive_history from record where id="' + receiveID + '"')
        result5 = curr.fetchall()
        print("result5:", result5)
        # if result2 and result3 and result4:
        #     for i in result2: i = list(i); result2 = ','.join(i)
        #     for i in result3: i = list(i); result3 = ','.join(i)
        #     for i in result4: i = list(i); result4 = ','.join(i)
        print("result2", result2)
        print("result3", result3)
        print("result4", result4)
        print("result5", result5)


        if result4 != result5:
            self.textEdit.append("")
            self.textEdit.append(str(receiveID)+"  "+"收到的信息")
            self.textEdit.append("时间:" + result4)
            self.textEdit.append("内容:"+result3)

        # 得到receive信息_结束***********************************************

            #保存receive信息到receive_history里面
            curr.execute('update record set receive_history = "' + str(result4) + '" where id="' + str(receiveID) + '"')


            # 保存receive信息到receive_history里面_结束


        # except:
        #     print("lineEditor is blank")

        conn.commit()
        curr.close()
        conn.close()

    def sendoutInfor(self):

        #receiveID = self.lineEdit.text()
        receiveID = "001"
        print("receiveID", receiveID)


        print("sendoutInfor")
        sendOut = self.textEdit_2.toPlainText()
        print("sendOut", sendOut)

        #送出信息*********************************************************
        # try:
        import sqlite3
        import datetime
        from datetime import datetime
        conn = sqlite3.connect("record.db", check_same_thread=False)
        curr = conn.cursor()
        curr.execute('update record set sendout = "' + str(sendOut) + '" where id="' + str(receiveID) + '"')
        curr.execute('update record set record_time_sendout = "' + currentTime + '" where id="' + str(receiveID) + '"')

        self.textEdit.append("")
        self.textEdit.append(str(receiveID)+"  " + "发送的信息")
        # except:
        #     print("lineEditor is blank")

        conn.commit()
        curr.close()
        conn.close()


def set_line_color(text_edit, line_number, color):
    cursor = text_edit.textCursor()
    cursor.movePosition(cursor.Start)
    for i in range(line_number - 1):
        cursor.movePosition(cursor.NextBlock)
    cursor.select(cursor.BlockUnderCursor)

    format = QTextCharFormat()
    format.setForeground(color)
    cursor.mergeCharFormat(format)

if __name__=="__main__":
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    app=QtWidgets.QApplication(sys.argv)
    Widget=myWin()
    Widget.showMaximized();
    Widget.show()
    sys.exit(app.exec_())

3. 运行结果

Python+Qt桌面端与网页端人工客服沟通工具

三、在线协助:

如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!
1)远程安装运行环境,代码调试
2)Qt, C++, Python入门指导
3)界面美化
4)软件制作

当前文章连接:https://blog.csdn.net/alicema1111/article/details/131258803

博主推荐文章:python人脸识别统计人数qt窗体-CSDN博客

博主推荐文章:Python Yolov5火焰烟雾识别源码分享-CSDN博客

                         Python OpenCV识别行人入口进出人数统计_python识别人数-CSDN博客

个人博客主页:alicema1111的博客_CSDN博客-Python,C++,网页领域博主

博主所有文章点这里alicema1111的博客_CSDN博客-Python,C++,网页领域博主文章来源地址https://www.toymoban.com/news/detail-495707.html

到了这里,关于Python+Qt桌面端与网页端人工客服沟通工具的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包