Python脚本一直在后台运行

2024-10-02 16:26:15 发布

您现在位置:Python中文网/ 问答频道 /正文

这是一个简单的脚本,用来计算一些神经心理学测试的Z分数。在

但最近代码似乎是在后台运行,甚至在退出程序后。这个问题以前不存在,我使用下面的启动块来确保程序以提升方式运行,并且显示的大小是正确的。在

程序可以使用一个“退出”命令来关闭系统退出,或者只需按顶部栏上的X按钮。不管怎样,程序都在后台运行。在

我哪里出错了?在

def progStructure():
    first_run = True
    if first_run:
        import os
        os.system("mode con: cols=160 lines=50")
        print("""
    ================================================
    PROGRAM GREETING
    ================================================
    """)

        mainStartup()
        first_run = False

    while settings("auto_run"):
        mainStartup()
        #this function contains the main program, but irrelevant to the question

    print("Auto shutdown enabled, program is shutting down.")

    wait(2)
    exit()
        #informs the user data has been saved then restarts


import ctypes, sys

def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False

if is_admin():
    progStructure()
else:
    ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, "", None, 0)
    progStructure()

我的excel书写功能:

^{pr2}$

Tags: therunimport程序falseifisos