python - Python 脚本没有响应
问题描述
(我是一个关于编程的初学者)我编写了一个 python GUI 来运行批处理文件,这些文件可以在本地 Steam 服务器上激活 CSGO 中的不同游戏模式。当我运行脚本时,一切正常,但在我执行命令后,程序不再响应。
import tkinter as tk
import subprocess
def startA():
subprocess.call([r'D:\CSGO_server\Arms_race.bat'])
def startCa():
subprocess.call([r'D:\CSGO_server\Casual.bat'])
def startCo():
subprocess.call([r'D:\CSGO_server\Competitive.bat'])
def startDea():
subprocess.call([r'D:\CSGO_server\Deathmatch.bat'])
def startDem():
subprocess.call([r'D:\CSGO_server\Demolition.bat'])
def startQ():
subprocess.call([r'D:\CSGO_server\Quit.bat'])
root = tk.Tk()
root.title("Settings")
frame = tk.Canvas(root)
frame.pack()
Armsrace = tk.Button(frame,
text="Arms_race",
fg="red",
command=startA)
Armsrace.pack(side=tk.BOTTOM)
Casual = tk.Button(frame,
text="Casual",
fg="red",
command=startCa)
Casual.pack(side=tk.BOTTOM)
Competitive = tk.Button(frame,
text="Competitive",
fg="red",
command=startCo)
Competitive.pack(side=tk.BOTTOM)
Deathmatch = tk.Button(frame,
text="Deathmatch",
fg="red",
command=startDea)
Deathmatch.pack(side=tk.BOTTOM)
Demolition = tk.Button(frame,
text="Demolition",
fg="red",
command=startDem)
Demolition.pack(side=tk.BOTTOM)
Stop = tk.Button(frame,
text="Stop Server",
fg="red",
command=startQ)
Stop.pack(side=tk.BOTTOM)
root.mainloop()
我只是忘记了一个循环吗?(但我已经有一个循环,那么我该怎么做呢?)或者它是完全不同的东西?
在此先感谢(也很抱歉没有将代码作为示例代码)
解决方案
你检查你的目录是否存在你的文件?
推荐阅读
- google-bigquery - 使用 Google Cloud Data Fusion 执行自定义 SQL 查询
- node.js - 检索数据后关闭 MongoDB 连接
- asp.net-mvc - 检索 DateTime 对象时出现 ActionResult 异常
- react-redux - 如何做 redux-saga 结合测试和 jest 和酶
- conv-neural-network - 带有水印图像的 CNN 对象检测和训练,它会起作用吗?
- php - 如何从同一浏览器将一个域的相同 cookie 收集到另一个域?
- python - Python del sys.modules 触发的问题
- python - 删除超过 182.5 天的文件 [删除几年前新复制的文件]
- python - 如何在 for 循环中连接这些字符串变量?
- python - 安装了 Anaconda 但安装 flake8 后没有名为“conda”的模块