优化PVZ运行判断逻辑
This commit is contained in:
parent
1b044a9995
commit
19031401d6
@ -10,7 +10,7 @@ import ctypes
|
|||||||
kernel32 = ctypes.windll.kernel32
|
kernel32 = ctypes.windll.kernel32
|
||||||
|
|
||||||
PROCESS_ALL_ACCESS = (0x000F0000 | 0x00100000 | 0xFFF)
|
PROCESS_ALL_ACCESS = (0x000F0000 | 0x00100000 | 0xFFF)
|
||||||
|
running = False
|
||||||
# 定义修改阳光和冷却的函数
|
# 定义修改阳光和冷却的函数
|
||||||
|
|
||||||
def change_sun(Phand, sun_num):
|
def change_sun(Phand, sun_num):
|
||||||
@ -75,8 +75,8 @@ def change_cooling(Phand, cooling):
|
|||||||
# 定义检测游戏是否运行的函数
|
# 定义检测游戏是否运行的函数
|
||||||
|
|
||||||
def find_game_window():
|
def find_game_window():
|
||||||
global running # 声明running为全局变量
|
global running
|
||||||
hwnd = win32gui.FindWindow(None, "植物大战僵尸v2.2 ")
|
hwnd = win32gui.FindWindow(None, game_title_entry.get())
|
||||||
if hwnd == 0:
|
if hwnd == 0:
|
||||||
messagebox.showinfo("提示", "植物大战僵尸没有运行,请先启动游戏!")
|
messagebox.showinfo("提示", "植物大战僵尸没有运行,请先启动游戏!")
|
||||||
# 将启动按钮设置为禁用状态
|
# 将启动按钮设置为禁用状态
|
||||||
@ -87,6 +87,7 @@ def find_game_window():
|
|||||||
start_button.config(text="启动")
|
start_button.config(text="启动")
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
running = True
|
||||||
_, pid = win32process.GetWindowThreadProcessId(hwnd)
|
_, pid = win32process.GetWindowThreadProcessId(hwnd)
|
||||||
Phand = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid)
|
Phand = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid)
|
||||||
# 如果游戏开始运行,重新激活启动按钮
|
# 如果游戏开始运行,重新激活启动按钮
|
||||||
|
38
PVZZZB_C4_gui.spec
Normal file
38
PVZZZB_C4_gui.spec
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['PVZ\\PVZZZB_C4_gui.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='PVZZZB_C4_gui',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=False,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
@ -10,4 +10,4 @@ MdImgUrlChange:将Markdown中图片链接格式化为hexo图片链接的一款
|
|||||||
|
|
||||||
植物大战僵尸杂交版v2.2修改器
|
植物大战僵尸杂交版v2.2修改器
|
||||||
|
|
||||||
pyinstaller --onefile --windowed .\PVZZZB_C4_gui.py
|
pyinstaller --onefile --windowed PVZ/PVZZZB_C4_gui.py
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -18,7 +18,7 @@ missing module named 'org.python' - imported by copy (optional)
|
|||||||
missing module named org - imported by pickle (optional)
|
missing module named org - imported by pickle (optional)
|
||||||
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
|
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
|
||||||
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
|
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
|
||||||
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
|
missing module named posix - imported by posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
|
||||||
missing module named resource - imported by posix (top-level)
|
missing module named resource - imported by posix (top-level)
|
||||||
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
|
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
|
||||||
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
|
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<div class="node">
|
<div class="node">
|
||||||
<a name="PVZZZB_C4_gui.py"></a>
|
<a name="PVZZZB_C4_gui.py"></a>
|
||||||
<a target="code" href="///C:/Users/xrilang/Desktop/pythonProject/PVZZZB_C4_gui.py" type="text/plain"><tt>PVZZZB_C4_gui.py</tt></a>
|
<a target="code" href="///C:/Users/xrilang/Desktop/pythonProject/PVZ/PVZZZB_C4_gui.py" type="text/plain"><tt>PVZZZB_C4_gui.py</tt></a>
|
||||||
<span class="moduletype">Script</span> <div class="import">
|
<span class="moduletype">Script</span> <div class="import">
|
||||||
imports:
|
imports:
|
||||||
<a href="#_collections_abc">_collections_abc</a>
|
<a href="#_collections_abc">_collections_abc</a>
|
||||||
@ -4984,7 +4984,6 @@ imports:
|
|||||||
• <a href="#importlib">importlib</a>
|
• <a href="#importlib">importlib</a>
|
||||||
• <a href="#importlib._bootstrap">importlib._bootstrap</a>
|
• <a href="#importlib._bootstrap">importlib._bootstrap</a>
|
||||||
• <a href="#importlib._bootstrap_external">importlib._bootstrap_external</a>
|
• <a href="#importlib._bootstrap_external">importlib._bootstrap_external</a>
|
||||||
• <a href="#importlib.machinery">importlib.machinery</a>
|
|
||||||
• <a href="#sys">sys</a>
|
• <a href="#sys">sys</a>
|
||||||
• <a href="#warnings">warnings</a>
|
• <a href="#warnings">warnings</a>
|
||||||
|
|
||||||
@ -5115,8 +5114,7 @@ imports:
|
|||||||
</div>
|
</div>
|
||||||
<div class="import">
|
<div class="import">
|
||||||
imported by:
|
imported by:
|
||||||
<a href="#importlib">importlib</a>
|
<a href="#importlib.abc">importlib.abc</a>
|
||||||
• <a href="#importlib.abc">importlib.abc</a>
|
|
||||||
• <a href="#inspect">inspect</a>
|
• <a href="#inspect">inspect</a>
|
||||||
• <a href="#py_compile">py_compile</a>
|
• <a href="#py_compile">py_compile</a>
|
||||||
|
|
||||||
|
BIN
dist/PVZZZB_C4_gui.exe
vendored
BIN
dist/PVZZZB_C4_gui.exe
vendored
Binary file not shown.
Loading…
Reference in New Issue
Block a user