Windows进程管理工具 - 使用Python和wxPython
我将为您创建一个功能完善的Windows进程管理工具,它能够显示系统进程、监控性能,并提供进程管理功能。
设计思路
- 使用wxPython构建GUI界面
- 使用psutil库获取进程和系统信息
- 实现进程列表、详细信息展示、进程操作等功能
- 添加系统性能监控图表
完整代码实现
import wx
import wx.grid
import wx.lib.agw.aui as aui
import psutil
import threading
import time
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure
class ProcessManager(wx.Frame):
def __init__(self, parent, title):
super(ProcessManager, self).__init__(parent, title=title, size=(1200, 800))
self.process_list = []
self.selected_pid = None
self.update_interval = 2 # 更新间隔(秒)
self.is_monitoring = False
# 初始化UI
self.init_ui()
# 启动进程列表更新
self.update_process_list()
self.start_performance_monitor()
# 设置定时器定期更新
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.on_update_timer, self.timer)
self.timer.Start(self.update_interval * 1000)
self.Centre()
self.Show()
def init_ui(self):
"""初始化用户界面"""
# 设置图标
self.SetIcon(wx.Icon('icon.ico', wx.BITMAP_TYPE_ICO) if wx.FileExists('icon.ico') else wx.NullIcon)
# 创建菜单栏
menubar = wx.MenuBar()
# 文件菜单
file_menu = wx.Menu()
refresh_item = file_menu.Append(wx.ID_REFRESH, "刷新进程列表\tF5", "刷新当前进程列表")
file_menu.AppendSeparator()
exit_item = file_menu.Append(wx.ID_EXIT, "退出\tCtrl+Q", "退出应用程序")
# 进程菜单
process_menu = wx.Menu()
self.end_task_item = process_menu.Append(wx.ID_ANY, "结束进程\tDel", "结束选中的进程")
self.end_tree_item = process_menu.Append(wx.ID_ANY, "结束进程树", "结束进程及其所有子进程")
process_menu.AppendSeparator()
self.set_priority_menu = wx.Menu()
process_menu.AppendSubMenu(self.set_priority_menu, "设置优先级")
self.create_priority_menu()
# 视图菜单
view_menu = wx.Menu()
self.auto_refresh_item = view_menu.AppendCheckItem(wx.ID_ANY, "自动刷新", "自动刷新进程列表")
self.auto_refresh_item.Check(True)
view_menu.AppendSeparator()
self.show_all_item = view_menu.AppendCheckItem(wx.ID_ANY, "显示所有进程", "显示系统进程和用户进程")
self.show_all_item.Check(True)
# 帮助菜单
help_menu = wx.Menu()
about_item = help_menu.Append(wx.ID_ABOUT, "关于", "关于进程管理器")
menubar.Append(file_menu, "文件(&F)")
menubar.Append(process_menu, "进程(&P)")
menubar.Append(view_menu, "视图(&V)")
menubar.Append(help_menu, "帮助(&H)")
self.SetMenuBar(menubar)
# 绑定菜单事件
self.Bind(wx.EVT_MENU, self.on_refresh, refresh_item)
self.Bind(wx.EVT_MENU, self.on_exit, exit_item)
self.Bind(wx.EVT_MENU, self.on_end_task, self.end_task_item)
self.Bind(wx.EVT_MENU, self.on_end_task_tree, self.end_tree_item)
self.Bind(wx.EVT_MENU, self.on_show_all, self.show_all_item)
self.Bind(wx.EVT_MENU, self.on_about, about_item)
# 创建工具栏
self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_TEXT)
refresh_tool = self.toolbar.AddTool(wx.ID_ANY, "刷新", wx.ArtProvider.GetBitmap(wx.ART_REDO))
end_task_tool = self.toolbar.AddTool(wx.ID_ANY, "结束进程", wx.ArtProvider.GetBitmap(wx.ART_CROSS_MARK))
self.toolbar.AddSeparator()
cpu_tool = self.toolbar.AddTool(wx.ID_ANY, "CPU使用率", wx.ArtProvider.GetBitmap(wx.ART_EXECUTABLE_FILE))
memory_tool = self.toolbar.AddTool(wx.ID_ANY, "内存使用", wx.ArtProvider.GetBitmap(wx.ART_HARDDISK))
self.toolbar.Realize()
# 绑定工具栏事件
self.Bind(wx.EVT_TOOL, self.on_refresh, refresh_tool)
self.Bind(wx.EVT_TOOL, self.on_end_task, end_task_tool)
# 创建状态栏
self.statusbar = self.CreateStatusBar(3)
self.statusbar.SetStatusWidths([-3, -2, -1])
# 创建AUI管理器
self.aui_mgr = aui.AuiManager()
self.aui_mgr.SetManagedWindow(self)
# 创建进程列表面板
self.create_process_list_panel()
# 创建进程详情面板
self.create_process_details_panel()
# 创建性能监控面板
self.create_performance_panel()
# 更新AUI布局
self.aui_mgr.Update()
# 绑定进程列表选择事件
self.process_grid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.on_process_select)
def create_process_list_panel(self):
"""创建进程列表面板"""
panel = wx.Panel(self)
vbox = wx.BoxSizer(wx.VERTICAL)
# 搜索框和过滤选项
hbox = wx.BoxSizer(wx.HORIZONTAL)
search_label = wx.StaticText(panel, label="搜索:")
hbox.Add(search_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
self.search_ctrl = wx.SearchCtrl(panel, style=wx.TE_PROCESS_ENTER)
self.search_ctrl.SetDescriptiveText("输入进程名或PID进行搜索")
hbox.Add(self.search_ctrl, 1, wx.EXPAND | wx.ALL, 5)
self.search_ctrl.Bind(wx.EVT_TEXT, self.on_search)
self.search_ctrl.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search)
vbox.Add(hbox, 0, wx.EXPAND)
# 创建进程列表网格
self.process_grid = wx.grid.Grid(panel)
self.process_grid.CreateGrid(0, 6)
self.process_grid.SetColLabelValue(0, "PID")
self.process_grid.SetColLabelValue(1, "进程名")
self.process_grid.SetColLabelValue(2, "状态")
self.process_grid.SetColLabelValue(3, "CPU(%)")
self.process_grid.SetColLabelValue(4, "内存(MB)")
self.process_grid.SetColLabelValue(5, "用户名")
# 设置列宽
self.process_grid.AutoSizeColumns()
self.process_grid.SetColSize(0, 80) # PID
self.process_grid.SetColSize(1, 200) # 进程名
self.process_grid.SetColSize(2, 80) # 状态
self.process_grid.SetColSize(3, 80) # CPU
self.process_grid.SetColSize(4, 100) # 内存
self.process_grid.SetColSize(5, 150) # 用户名
# 设置网格属性
self.process_grid.EnableEditing(False)
self.process_grid.SetSelectionMode(wx.grid.Grid.SelectRows)
vbox.Add(self.process_grid, 1, wx.EXPAND | wx.ALL, 5)
panel.SetSizer(vbox)
# 添加到AUI管理器
self.aui_mgr.AddPane(panel, aui.AuiPaneInfo().
Caption("进程列表").
Center().
Layer(0).
CloseButton(False).
MaximizeButton(True).
BestSize((800, 400)))
def create_process_details_panel(self):
"""创建进程详情面板"""
panel = wx.Panel(self)
vbox = wx.BoxSizer(wx.VERTICAL)
# 进程基本信息
info_label = wx.StaticText(panel, label="进程详细信息")
info_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
vbox.Add(info_label, 0, wx.ALL, 10)
# 创建详细信息文本控件
self.details_text = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
self.details_text.SetFont(wx.Font(10, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
vbox.Add(self.details_text, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
panel.SetSizer(vbox)
# 添加到AUI管理器
self.aui_mgr.AddPane(panel, aui.AuiPaneInfo().
Caption("进程详细信息").
Right().
Layer(1).
CloseButton(False).
BestSize((350, 400)))
def create_performance_panel(self):
"""创建性能监控面板"""
panel = wx.Panel(self)
vbox = wx.BoxSizer(wx.VERTICAL)
# 性能监控标题
perf_label = wx.StaticText(panel, label="系统性能监控")
perf_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
vbox.Add(perf_label, 0, wx.ALL, 10)
# CPU使用率图表
cpu_box = wx.StaticBox(panel, label="CPU使用率")
cpu_sizer = wx.StaticBoxSizer(cpu_box, wx.VERTICAL)
self.cpu_figure = Figure(figsize=(5, 2))
self.cpu_canvas = FigureCanvas(panel, -1, self.cpu_figure)
self.cpu_ax = self.cpu_figure.add_subplot(111)
self.cpu_data = []
cpu_sizer.Add(self.cpu_canvas, 1, wx.EXPAND | wx.ALL, 5)
vbox.Add(cpu_sizer, 1, wx.EXPAND | wx.ALL, 5)
# 内存使用图表
memory_box = wx.StaticBox(panel, label="内存使用")
memory_sizer = wx.StaticBoxSizer(memory_box, wx.VERTICAL)
self.memory_figure = Figure(figsize=(5, 2))
self.memory_canvas = FigureCanvas(panel, -1, self.memory_figure)
self.memory_ax = self.memory_figure.add_subplot(111)
self.memory_data = []
memory_sizer.Add(self.memory_canvas, 1, wx.EXPAND | wx.ALL, 5)
vbox.Add(memory_sizer, 1, wx.EXPAND | wx.ALL, 5)
# 系统信息
sysinfo_box = wx.StaticBox(panel, label="系统信息")
sysinfo_sizer = wx.StaticBoxSizer(sysinfo_box, wx.VERTICAL)
self.sysinfo_text = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY)
sysinfo_sizer.Add(self.sysinfo_text, 1, wx.EXPAND | wx.ALL, 5)
vbox.Add(sysinfo_sizer, 1, wx.EXPAND | wx.ALL, 5)
panel.SetSizer(vbox)
# 添加到AUI管理器
self.aui_mgr.AddPane(panel, aui.AuiPaneInfo().
Caption("性能监控").
Bottom().
Layer(1).
CloseButton(False).
BestSize((800, 300)))
def create_priority_menu(self):
"""创建优先级菜单"""
priorities = [
("实时", psutil.REALTIME_PRIORITY_CLASS),
("高", psutil.HIGH_PRIORITY_CLASS),
("高于正常", psutil.ABOVE_NORMAL_PRIORITY_CLASS),
("正常", psutil.NORMAL_PRIORITY_CLASS),
("低于正常", psutil.BELOW_NORMAL_PRIORITY_CLASS),
("低", psutil.IDLE_PRIORITY_CLASS)
]
for name, value in priorities:
item = self.set_priority_menu.Append(wx.ID_ANY, name)
self.Bind(wx.EVT_MENU, lambda event, v=value: self.on_set_priority(v), item)
def update_process_list(self):
"""更新进程列表"""
try:
# 获取进程列表
processes = []
for proc in psutil.process_iter(['pid', 'name', 'status', 'cpu_percent', 'memory_info', 'username']):
try:
processes.append(proc)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
continue
# 排序:按CPU使用率降序
processes.sort(key=lambda p: p.info['cpu_percent'], reverse=True)
# 保存进程列表
self.process_list = processes
# 更新表格
self.update_process_grid()
# 更新状态栏
self.update_status_bar()
except Exception as e:
wx.MessageBox(f"更新进程列表时出错: {str(e)}", "错误", wx.OK | wx.ICON_ERROR)
def update_process_grid(self):
"""更新进程表格"""
# 清空表格
if self.process_grid.GetNumberRows() > 0:
self.process_grid.DeleteRows(0, self.process_grid.GetNumberRows())
# 获取搜索文本
search_text = self.search_ctrl.GetValue().lower()
# 添加进程到表格
row = 0
for proc in self.process_list:
info = proc.info
# 过滤搜索
if search_text:
if (search_text not in str(info['pid']).lower() and
search_text not in info['name'].lower()):
continue
# 过滤系统进程
if not self.show_all_item.IsChecked():
if info['username'] and 'SYSTEM' in info['username'].upper():
continue
self.process_grid.AppendRows(1)
# PID
self.process_grid.SetCellValue(row, 0, str(info['pid']))
# 进程名
self.process_grid.SetCellValue(row, 1, info['name'])
# 状态
status = info['status']
self.process_grid.SetCellValue(row, 2, status)
# 根据状态设置颜色
if status == psutil.STATUS_RUNNING:
self.process_grid.SetCellTextColour(row, 2, wx.Colour(0, 128, 0))
elif status == psutil.STATUS_SUSPENDED:
self.process_grid.SetCellTextColour(row, 2, wx.Colour(255, 165, 0))
elif status == psutil.STATUS_ZOMBIE:
self.process_grid.SetCellTextColour(row, 2, wx.Colour(255, 0, 0))
# CPU使用率
cpu_percent = info['cpu_percent']
self.process_grid.SetCellValue(row, 3, f"{cpu_percent:.1f}")
# 根据CPU使用率设置颜色
if cpu_percent > 50:
self.process_grid.SetCellTextColour(row, 3, wx.Colour(255, 0, 0))
elif cpu_percent > 20:
self.process_grid.SetCellTextColour(row, 3, wx.Colour(255, 165, 0))
# 内存使用(MB)
if info['memory_info']:
memory_mb = info['memory_info'].rss / (1024 * 1024)
self.process_grid.SetCellValue(row, 4, f"{memory_mb:.1f}")
# 用户名
username = info['username'] or "N/A"
self.process_grid.SetCellValue(row, 5, username)
row += 1
def update_process_details(self, pid):
"""更新进程详细信息"""
try:
if pid is None:
self.details_text.SetValue("未选择进程")
return
proc = psutil.Process(pid)
info = proc.as_dict(attrs=[
'pid', 'name', 'status', 'cpu_percent', 'memory_percent',
'memory_info', 'create_time', 'exe', 'cwd', 'cmdline',
'username', 'nice', 'ppid', 'num_threads'
])
details = f"""进程ID (PID): {info['pid']}
进程名称: {info['name']}
状态: {info['status']}
CPU使用率: {info['cpu_percent']:.1f}%
内存使用率: {info['memory_percent']:.1f}%
物理内存: {info['memory_info'].rss / (1024*1024):.1f} MB
虚拟内存: {info['memory_info'].vms / (1024*1024):.1f} MB
创建时间: {datetime.fromtimestamp(info['create_time']).strftime('%Y-%m-%d %H:%M:%S')}
可执行文件: {info['exe'] or 'N/A'}
工作目录: {info['cwd'] or 'N/A'}
命令行: {' '.join(info['cmdline']) if info['cmdline'] else 'N/A'}
用户名: {info['username'] or 'N/A'}
优先级: {info['nice']}
父进程ID: {info['ppid']}
线程数: {info['num_threads']}"""
self.details_text.SetValue(details)
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
self.details_text.SetValue(f"无法获取进程信息: {str(e)}")
def update_performance_monitor(self):
"""更新性能监控"""
try:
# CPU使用率
cpu_percent = psutil.cpu_percent(interval=None)
self.cpu_data.append(cpu_percent)
# 只保留最近60个数据点
if len(self.cpu_data) > 60:
self.cpu_data.pop(0)
# 更新CPU图表
self.cpu_ax.clear()
self.cpu_ax.plot(self.cpu_data, 'b-', linewidth=2)
self.cpu_ax.set_ylim(0, 100)
self.cpu_ax.set_ylabel('CPU (%)')
self.cpu_ax.set_title(f'CPU使用率: {cpu_percent:.1f}%')
self.cpu_ax.grid(True, alpha=0.3)
self.cpu_figure.tight_layout()
self.cpu_canvas.draw()
# 内存使用率
memory = psutil.virtual_memory()
memory_percent = memory.percent
self.memory_data.append(memory_percent)
# 只保留最近60个数据点
if len(self.memory_data) > 60:
self.memory_data.pop(0)
# 更新内存图表
self.memory_ax.clear()
self.memory_ax.plot(self.memory_data, 'r-', linewidth=2)
self.memory_ax.set_ylim(0, 100)
self.memory_ax.set_ylabel('内存 (%)')
self.memory_ax.set_title(f'内存使用: {memory_percent:.1f}% ({memory.used/(1024**3):.1f} GB / {memory.total/(1024**3):.1f} GB)')
self.memory_ax.grid(True, alpha=0.3)
self.memory_figure.tight_layout()
self.memory_canvas.draw()
# 更新系统信息
sysinfo = f"""系统信息:
CPU核心数: {psutil.cpu_count(logical=False)} 物理核心 / {psutil.cpu_count(logical=True)} 逻辑核心
CPU频率: {psutil.cpu_freq().current:.0f} MHz
内存: {memory.used/(1024**3):.1f} GB / {memory.total/(1024**3):.1f} GB ({memory_percent:.1f}%)
磁盘使用: {psutil.disk_usage('/').percent:.1f}%
系统启动时间: {datetime.fromtimestamp(psutil.boot_time()).strftime('%Y-%m-%d %H:%M:%S')}"""
self.sysinfo_text.SetValue(sysinfo)
except Exception as e:
print(f"更新性能监控时出错: {e}")
def update_status_bar(self):
"""更新状态栏"""
# 进程总数
total_processes = len(self.process_list)
# 运行中的进程数
running_processes = sum(1 for p in self.process_list if p.info['status'] == psutil.STATUS_RUNNING)
# 总内存使用
total_memory = 0
for proc in self.process_list:
if proc.info['memory_info']:
total_memory += proc.info['memory_info'].rss
total_memory_mb = total_memory / (1024 * 1024)
# 更新状态栏
self.statusbar.SetStatusText(f"进程总数: {total_processes}", 0)
self.statusbar.SetStatusText(f"运行中: {running_processes}", 1)
self.statusbar.SetStatusText(f"总内存: {total_memory_mb:.1f} MB", 2)
def start_performance_monitor(self):
"""启动性能监控线程"""
def monitor():
while self.is_monitoring:
wx.CallAfter(self.update_performance_monitor)
time.sleep(1)
self.is_monitoring = True
monitor_thread = threading.Thread(target=monitor, daemon=True)
monitor_thread.start()
def on_update_timer(self, event):
"""定时器事件处理"""
if self.auto_refresh_item.IsChecked():
self.update_process_list()
if self.selected_pid:
self.update_process_details(self.selected_pid)
def on_process_select(self, event):
"""进程选择事件处理"""
row = event.GetRow()
if row >= 0 and row < self.process_grid.GetNumberRows():
pid_str = self.process_grid.GetCellValue(row, 0)
if pid_str.isdigit():
self.selected_pid = int(pid_str)
self.update_process_details(self.selected_pid)
event.Skip()
def on_refresh(self, event):
"""刷新按钮事件处理"""
self.update_process_list()
def on_search(self, event):
"""搜索事件处理"""
self.update_process_grid()
def on_show_all(self, event):
"""显示所有进程事件处理"""
self.update_process_grid()
def on_end_task(self, event):
"""结束进程事件处理"""
if self.selected_pid is None:
wx.MessageBox("请先选择一个进程", "提示", wx.OK | wx.ICON_INFORMATION)
return
try:
proc = psutil.Process(self.selected_pid)
proc_name = proc.name()
# 确认对话框
dlg = wx.MessageDialog(self,
f"确定要结束进程 '{proc_name}' (PID: {self.selected_pid}) 吗?",
"确认结束进程",
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
if dlg.ShowModal() == wx.ID_YES:
proc.terminate()
wx.MessageBox(f"进程 '{proc_name}' 已结束", "成功", wx.OK | wx.ICON_INFORMATION)
self.update_process_list()
dlg.Destroy()
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
wx.MessageBox(f"无法结束进程: {str(e)}", "错误", wx.OK | wx.ICON_ERROR)
def on_end_task_tree(self, event):
"""结束进程树事件处理"""
if self.selected_pid is None:
wx.MessageBox("请先选择一个进程", "提示", wx.OK | wx.ICON_INFORMATION)
return
try:
proc = psutil.Process(self.selected_pid)
proc_name = proc.name()
# 获取进程树
children = proc.children(recursive=True)
total_processes = len(children) + 1
# 确认对话框
dlg = wx.MessageDialog(self,
f"确定要结束进程树吗?\n\n"
f"主进程: {proc_name} (PID: {self.selected_pid})\n"
f"子进程数: {len(children)}\n"
f"总共 {total_processes} 个进程将被结束",
"确认结束进程树",
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING)
if dlg.ShowModal() == wx.ID_YES:
# 先结束子进程
for child in children:
try:
child.terminate()
except:
pass
# 再结束父进程
proc.terminate()
wx.MessageBox(f"进程树已结束 (共 {total_processes} 个进程)", "成功", wx.OK | wx.ICON_INFORMATION)
self.update_process_list()
dlg.Destroy()
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
wx.MessageBox(f"无法结束进程树: {str(e)}", "错误", wx.OK | wx.ICON_ERROR)
def on_set_priority(self, priority):
"""设置进程优先级"""
if self.selected_pid is None:
wx.MessageBox("请先选择一个进程", "提示", wx.OK | wx.ICON_INFORMATION)
return
try:
proc = psutil.Process(self.selected_pid)
proc.nice(priority)
wx.MessageBox(f"进程优先级已设置为 {priority}", "成功", wx.OK | wx.ICON_INFORMATION)
self.update_process_details(self.selected_pid)
except (psutil.NoSuchProcess, psutil.AccessDenied) as e:
wx.MessageBox(f"无法设置优先级: {str(e)}", "错误", wx.OK | wx.ICON_ERROR)
def on_about(self, event):
"""关于对话框"""
info = wx.AboutDialogInfo()
info.Name = "Windows进程管理器"
info.Version = "1.0.0"
info.Description = "基于Python和wxPython开发的Windows进程管理工具\n\n"
info.Description += "功能特性:\n"
info.Description += "• 查看系统所有进程\n"
info.Description += "• 实时监控CPU和内存使用\n"
info.Description += "• 结束进程和进程树\n"
info.Description += "• 设置进程优先级\n"
info.Description += "• 搜索和过滤进程\n"
info.Copyright = "(C) 2023"
info.Developers = ["Python开发者"]
wx.AboutBox(info)
def on_exit(self, event):
"""退出应用程序"""
self.is_monitoring = False
self.timer.Stop()
self.aui_mgr.UnInit()
self.Destroy()
class ProcessManagerApp(wx.App):
def OnInit(self):
# 设置应用程序名称
self.SetAppName("ProcessManager")
# 创建主窗口
frame = ProcessManager(None, "Windows进程管理器")
# 检查psutil是否可用
try:
import psutil
except ImportError:
wx.MessageBox("请先安装psutil库: pip install psutil", "错误", wx.OK | wx.ICON_ERROR)
return False
return True
def main():
app = ProcessManagerApp()
app.MainLoop()
if __name__ == "__main__":
main()
功能说明
主要功能
进程列表查看:
- 显示所有运行中的进程
- 显示PID、进程名、状态、CPU使用率、内存使用和用户名
- 支持按列排序和颜色标记
进程管理:
- 结束单个进程
- 结束整个进程树
- 设置进程优先级(实时、高、正常、低等)
进程详细信息:
- 显示选定进程的详细信息
- 包括可执行路径、命令行参数、创建时间等
系统性能监控:
- 实时CPU使用率图表
- 实时内存使用图表
- 系统信息显示
搜索和过滤:
安装和运行
安装依赖
pip install wxPython psutil matplotlib
运行程序
python process_manager.py
注意事项
某些功能(如结束系统进程、修改优先级)可能需要管理员权限
程序使用了多线程进行性能监控,确保在退出时正确清理资源
对于大量进程的系统,更新可能会有轻微延迟
这个进程管理工具提供了Windows任务管理器的基本功能,并添加了一些增强特性。您可以根据需要进一步扩展功能,例如添加网络监控、磁盘监控或进程启动历史记录等功能。