|
本帖最后由 qwq 于 2023-10-25 20:53 编辑
- import tkinter as tk
- import psutil
- import asyncio
- import time
- print('cpu count: {}'.format(psutil.cpu_count()))
- for x in range(1):
- print('cpu percent: {}'.format(psutil.cpu_percent(interval=0.3)))
- window = tk.Tk()
- window.attributes('-alpha',0.8)
- window.attributes("-topmost",True)
- window.overrideredirect(1)
- main_lable = tk.Label()
- main_lable.pack()
- window.geometry("+850+800")
- def cchange():
- usage = "CPU使用量" + str(psutil.cpu_percent(interval=0.3)) + "%" + "RAM使用量" + str(psutil.virtual_memory()[2]) + "%"
- main_lable.config(text = usage)
- window.after(1000, cchange)
- window.after(1000, cchange)
- window.mainloop()
复制代码
|
|