import tkinter
from tkinter import ttk
import platform
import cpuinfo
import psutil
import threading
import datetime
import webbrowser
import subprocess
name = str(platform.system())
version = str(platform.release())
root = tkinter.Tk()
#root.iconbitmap("icon.ico")
root.resizable(width=False, height=False)
#OS information
label0 = ttk.Label(root, text='Your OS:' + name + ' ' + version)
label0.config(font=("Roboto", 30))
label0.pack()
root.title("PC info")
def get_cpu_type():
if name == "Windows":
from win32com.client import GetObject
root_winmgmts = GetObject("winmgmts:root\cimv2")
cpus = root_winmgmts.ExecQuery("Select * from Win32_Processor")
return cpus[0].Name
else:
print("Processors: ")
with open("/proc/cpuinfo", "r") as f:
info = f.readlines()
cpuinfo = [x.strip().split(":")[1] for x in info if "model name" in x]
for index, item in enumerate(cpuinfo):
return item
label1 = ttk.Label(root, text="CPU:"+get_cpu_type())
label1.config(font=("Roboto", 30))
label1.pack()
def frequency():
rer = str(psutil.cpu_freq(percpu=False))
label2['text'] = rer[1:]
root.after(1, frequency)
def set_label():
label6['text'] = str(psutil.cpu_percent(interval=1, percpu=False)) + '%'
root.after(1, set_label)
label2 = ttk.Label(root, text='')
label2.config(font=("Roboto", 30))
label2.pack()
label6 = ttk.Label(root, text='')
label6.config(font=("Roboto", 30))
label6.pack()
def start():
x = threading.Thread(target=set_label(), args=(1,), daemon=True)
x.start()
print(x.ident)
def start_freq():
y = threading.Thread(target=frequency(), args=(1,), daemon=True)
y.start()
print(y.ident)
label7 = ttk.Label(root, text='CPU cores:' + str(psutil.cpu_count()))
label7.config(font=("Roboto", 30))
label7.pack()
start()
start_freq()
root.mainloop()