def build(self): self.title = 'ใในใ' layout = Widget() layout.size = Window.size # image = Image.open('./monitor-1.png') with mss() as sct: rect = {'top': 0, 'left': 0, 'width': WIDTH, 'height': HEIGHT} sct_img = sct.grab(rect) image = Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX") texture = Texture.create(size=image.size) texture.blit_buffer(image.tobytes()) texture.flip_vertical() with layout.canvas.before: layout.rect = Rectangle(texture=texture, pos=layout.pos, size=layout.size) return layout