cpudialog.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:rockthetaskbar 作者: jamesabel 项目源码 文件源码
def __init__(self, cpu_histogram):
        super().__init__()

        # set up the graphical elements
        layout = QGridLayout(self)
        self.setLayout(layout)
        fig = Figure()
        layout.addWidget(FigureCanvas(fig))

        # do the plotting
        ax = fig.add_subplot(1, 1, 1)  # 1x1 grid, first subplot
        ax.set_title('CPU Usage Histogram (%s Cores/%s Threads)' % (psutil.cpu_count(False), psutil.cpu_count(True)))
        ax.set_ylabel('Count')
        ax.set_xlabel('CPU %')
        ax.grid(True)
        xs = range(0, 101)
        ax.plot(xs, [cpu_histogram[x] for x in xs])
        ax.xaxis.set_major_locator(MultipleLocator(10.))

        self.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号