导出到png不保存绘图kivy

2024-10-03 15:25:29 发布

您现在位置:Python中文网/ 问答频道 /正文

在我画了一个图像后,我试图用export\u to \u png保存所画图像的捕获。导出只保存我包含的边框和说明。我怎样才能同时导出带有边框和说明的图纸?你知道吗

你知道吗牵引.kv你知道吗

#:import utils kivy.utils

<Draw>:
    FloatLayout:
        BoxLayout:
            id: myexport
            canvas.before:
                Color:
                    rgba: .5, .5, .5, .5
                Line:
                    width: 50
                    rectangle: self.x, self.y, self.width, self.height

            Label:
                pos_hint: {"top": .9, "center_x": .5}
                size_hint: 1, .1
                text: "Draw an image"
                font_size: 25
    Button:
        pos_hint: {"top": .1, "right": 1}
        size_hint: .1, .1
        text:
            "Submit"
        on_release:
            myexport.export_to_png("drawing.png", scale = float)

Tags: totextpos图像selfsizepngtop