【发布时间】:2017-07-13 08:16:24
【问题描述】:
尝试在我的 GUI 中显示 cpu 使用情况时出现此错误
cputext = tk.Label(self, text="CPU", cpu) ^ SyntaxError: 位置参数跟随关键字参数
这是我的代码
x = (2)
while x > 0:
cpu = psutil.cpu_percent(interval=1, percpu=False)
cputext = tk.Label(self, text="CPU", cpu)
cputext.pack()
当我这样打印时,没问题,但它正在控制台中打印
print("CPU Usage :", cpu)
【问题讨论】:
标签: python-3.x tkinter label