Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
625 views
in Technique[技术] by (71.8m points)

colors - How to make image background white instead of black?

I am a beginner. I have this kv code:

<Pat_layout>:

    BoxLayout:
        orientation: "vertical"
        size: root.width, root.height

        Label:
            id: name_label
            text:  "Exercises Appear Here"
            font_size: 32

        Image:
            id: image_window
            size_hint: (1, .5)
            source: 'images/dim_6543.jpg'

        Button:
            background_normal: ''
            background_color: 0, .3, .4, .95
            size_hint: (1, .5)
            font_size: 32
            text: "Press For Next Exercise"
            on_press: root.press()

And I get this: output image with label, image, button

The chord diagram should have a white background. I have searched and tried things for hours, days. How can I get the middle section, the image, to show a white background around the chord diagram? The chord diagram does not have any surrounding background; it's been cropped to just the diagram.

Any help would be tremendously appreciated....

Thank you.

question from:https://stackoverflow.com/questions/65874504/how-to-make-image-background-white-instead-of-black

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You want to draw a white rectangle filling the Image. The code for this is something like:

Image:
    canvas.before:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...