【项目实战】基于Python+Tkinter的GUI防作弊考试系统(附完整源码)

1、项目说明

基于python+tkinter的防作弊考试系统

项目需要安装pycharm以及项目所需的库包括tkinter、psutil、pandas等其他项目所需模块
安装命令如下:

直接运行exe文件时,exe所在的目录下必须要有Files及其里面的表格和文档(不然会报错)

项目打包为exe文件需要安装pyinstaller
执行命令:pyinstaller -F -w main.py -i logo图片的地址
 

2、项目主要技术

  • python编程技术

  • tkinter界面编程

 

3、项目结构

  • files 项目所需的表格以及存放用户账号密码的txt文件

  • AntiCheating.py 防作弊代码实现

  • Config.py 项目的配置文件(配置常量和方法)

  • Functions.py 从表格数据中随机提取题目组卷代码实现

  • main.py 项目界面及功能实现代码

 

4、项目主要功能

  • 用户登录注册

  • 自定义题目

  • 考生考试

  • 分数计算

 

5、部分源码

AntiCheating.py

"""
项目名称:python 考试系统
作者:bhml
时间:2022/11/28
代码功能:防作弊功能实现实现(复制粘贴,浏览器搜索)
"""
import os
import time
import tkinter
import threading
import ctypes
import psutil

root = tkinter.Tk()
root.title('防作弊演示')
# 窗口初始大小和位置
root.geometry('300x100+300+100')
# 不允许改变窗口大小
root.resizable(False, False)
ban = tkinter.IntVar(root, 0)


# 强行关闭主流文本编辑器和网页浏览器
def funcBan():
    while ban.get() == 1:
        for pid in psutil.pids():
            try:
                p = psutil.Process(pid)
                exeName = os.path.basename(p.exe()).lower()
                if exeName in ('notepad.exe', 'winword.exe', 'wps.exe', 'wordpad.exe', 'iexplore.exe',
                               'chrome.exe', 'qqbrowser.exe', '360chrome.exe', '360se.exe',
                               'sogouexplorer.exe', 'firefox.exe', 'opera.exe', 'maxthon.exe',
                               'netscape.exe', 'baidubrowser.exe', '2345Explorer.exe'):
                    p.kill()
            except:
                pass
        # 清空系统剪切板
        ctypes.windll.user32.OpenClipboard(None)
        ctypes.windll.user32.EmptyClipboard()
        ctypes.windll.user32.CloseClipboard()
        time.sleep(1)


# 开启
def Anti_start():
    ban.set(1)
    t = threading.Thread(target=funcBan)
    t.start()


# 停止
def Anti_stop():
    ban.set(0)


# 测试
buttonStart = tkinter.Button(root, text='开始考试', command=Anti_start)
buttonStart.place(x=20, y=10, width=100, height=30)
buttonStop = tkinter.Button(root, text='结束考试', command=Anti_stop)
buttonStop.place(x=130, y=10, width=100, height=30)
# 模拟用,开启考试模式以后,所有内容都不再允许复制
entryMessage = tkinter.Entry(root)
entryMessage.place(x=10, y=40, width=230, height=30)
root.mainloop()

 

6、运行截图

 

 

 

 

7、项目总结

本项目是一个非常适合练手的项目,对我们的python编程技术结合tkinter模块运用开发的提升有很大的帮助,推荐大家学习研究这个项目,搞懂其中的业务逻辑流程以及各个知识点非常关键。
 
项目资料截图:

资料获取地址:https://h5.m.taobao.com/awp/core/detail.htm?ft=t&id=698838259245
B站视频讲解地址:https://www.bilibili.com/video/BV1a3411m74v/
 
注:其他问题请参看视频讲解,都有介绍,一定要认真看完哦!
代码编写、视频录制不易,感谢您的支持,祝您学习愉快!
 

避免走丢,记得关注哦🌹🌹🌹

posted @ 2023-03-16 19:57  兵慌码乱  阅读(794)  评论(0编辑  收藏  举报