【问题标题】:How to make image background white instead of black?如何使图像背景变为白色而不是黑色?
【发布时间】:2021-04-28 15:39:38
【问题描述】:

我是初学者。我有这个 kv 代码:

:

    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()

我明白了: output image with label, image, button

和弦图应该有白色背景。我已经搜索并尝试了几个小时,几天。如何让中间部分(图像)在和弦图周围显示白色背景?和弦图没有任何周边背景;它被裁剪成图表。

任何帮助将不胜感激......

谢谢。

【问题讨论】:

    标签: image colors background kivy


    【解决方案1】:

    好的,谢谢你!我复制了你的代码,它工作得很好!谢谢!

    吉姆

    【讨论】:

      【解决方案2】:

      您想绘制一个填充图像的白色矩形。代码如下:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-12-13
        • 1970-01-01
        • 1970-01-01
        • 2013-07-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多