delta_tuner.py 文件源码

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

项目:DeltaTuner 作者: payala 项目源码 文件源码
def redraw(self):
        self.canvas.clear()
        with self.canvas:
            Color(*COL_FG)
            total_ticks = int(self.total_axis_space/self.space_btw_marks)
            for i in range(total_ticks):
                if i % 5 == 0:
                    # Long Mark
                    mark = self.mark_length
                else:
                    # Short Mark
                    mark = self.mark_length / 2
                Line(points=[self.fwidth - mark, i * self.space_btw_marks,
                             self.fwidth, i * self.space_btw_marks,
                             self.fwidth, (i + 1) * self.space_btw_marks])
            i = int(self.total_axis_space/self.space_btw_marks)
            Line(points=[self.fwidth - self.mark_length, i * self.space_btw_marks,
                         self.fwidth, i * self.space_btw_marks])

            for i in range(int(total_ticks / 5) + 1):
                label = CoreLabel()
                label.text = "{:.1f}".format(0.1 * i)
                label.refresh()
                label_texture = label.texture
                texture_size = list(label_texture.size)
                Rectangle(texture=label_texture,
                          size=[s * 0.9 for s in texture_size],
                          pos=(0, i * 5 *self.space_btw_marks - 2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号