c64_painter.py 文件源码

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

项目:Pythonista-C64-Painter 作者: superrune 项目源码 文件源码
def init_pixel_grid(self):
        s = self.width/self.row if self.row > self.column else self.height/self.column
        with ui.ImageContext(*self.frame[2:]) as ctx:
            for y in xrange(self.column):
                for x in xrange(self.row):
                    # Fills image with pixels
                    # Changing this changes the pixel aspect
                    pixel = Pixel(x*s*2, y*s, s*2, s)
                    pixel.index = len(self.pixels)
                    pixel.position = (x,y)
                    self.pixels.append(pixel) #Adds this pixel to the pixels list
        return ctx.get_image()

    # Draw the pixel and character grid
    # This function is pretty slow. Find a way to speed it up.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号