This commit is contained in:
dengrb1
2023-05-07 22:16:11 +08:00
committed by GitHub
parent cc39e4ed36
commit 73b62403ef
4 changed files with 59 additions and 14 deletions

60
没有使用/wifi.py Normal file
View File

@@ -0,0 +1,60 @@
import socket
from time import sleep
import os
import platform
import sys
ml = os.getcwd()
s = platform.system()
def is_connected():
try:
# 使用百度的IP地址进行连接测试
socket.create_connection(("www.baidu.com", 80))
return True
except OSError:
pass
return False
def open_exe():
if os.path.exists(os.path.join(ml, f"client.exe")):
os.system(f"start client.exe")
else:
print('文件丢失,请重新安装')
sleep(1)
pass
pass
# mainloop
print('正在启动检测程序...')
sleep(0.22222)
if s == "Windows":
pass
else:
print("无法启动不是Windows系统")
sleep(1)
sys.exit()
if is_connected():
print("网络已连接,正在启动主程序!!")
sleep(0.33)
open_exe()
else:
print("网络未连接,是否继续使用?")
input_xz = str(input("选择:1.是 2.不是(必须选择数字)"))
if input_xz == None:
print("没有输入")
sleep(0.5)
print("默认退出")
sleep(0.6)
sys.exit()
pass
elif input_xz != '1' or '2':
print("请输入数字!!")
pass
elif input_xz == '1':
open_exe('client')
elif input_xz == '2':
sleep(0.4)
sys.exit()