• <bdo id='r2Amb'></bdo><ul id='r2Amb'></ul>

      1. <legend id='r2Amb'><style id='r2Amb'><dir id='r2Amb'><q id='r2Amb'></q></dir></style></legend>
      2. <i id='r2Amb'><tr id='r2Amb'><dt id='r2Amb'><q id='r2Amb'><span id='r2Amb'><b id='r2Amb'><form id='r2Amb'><ins id='r2Amb'></ins><ul id='r2Amb'></ul><sub id='r2Amb'></sub></form><legend id='r2Amb'></legend><bdo id='r2Amb'><pre id='r2Amb'><center id='r2Amb'></center></pre></bdo></b><th id='r2Amb'></th></span></q></dt></tr></i><div id='r2Amb'><tfoot id='r2Amb'></tfoot><dl id='r2Amb'><fieldset id='r2Amb'></fieldset></dl></div>

        <tfoot id='r2Amb'></tfoot>

        <small id='r2Amb'></small><noframes id='r2Amb'>

      3. 有没有一种简单的方法可以在没有图像的情况下

        时间:2023-10-09

            <small id='lBHqn'></small><noframes id='lBHqn'>

          1. <tfoot id='lBHqn'></tfoot>
            <i id='lBHqn'><tr id='lBHqn'><dt id='lBHqn'><q id='lBHqn'><span id='lBHqn'><b id='lBHqn'><form id='lBHqn'><ins id='lBHqn'></ins><ul id='lBHqn'></ul><sub id='lBHqn'></sub></form><legend id='lBHqn'></legend><bdo id='lBHqn'><pre id='lBHqn'><center id='lBHqn'></center></pre></bdo></b><th id='lBHqn'></th></span></q></dt></tr></i><div id='lBHqn'><tfoot id='lBHqn'></tfoot><dl id='lBHqn'><fieldset id='lBHqn'></fieldset></dl></div>
              <tbody id='lBHqn'></tbody>

              <bdo id='lBHqn'></bdo><ul id='lBHqn'></ul>

                <legend id='lBHqn'><style id='lBHqn'><dir id='lBHqn'><q id='lBHqn'></q></dir></style></legend>
                  本文介绍了有没有一种简单的方法可以在没有图像的情况下为 Kivy 标签、按钮、小部件等添加边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试为 Kivy 按钮添加边框,但它没有按预期工作.对于标签,我的实现似乎没问题,但对于按钮,它会覆盖/清除按钮的标准外观.

                  如何在不改变正常行为的情况下在按钮上方绘制边框?我想像 ButtonBehavior 一样实现它,这样我就可以使用画布为每个 Kivy 对象添加边框.我称之为 BorderBehavior.

                  样式虚线,点线仅适用于线宽 1,因为 Kivy 中存在错误(请参阅

                  解决方案

                  好的,我找到了解决方法.这是一个命名冲突.

                  在控制台日志中,我看到在按钮的 BorderImage 中解包边框元组时出现问题.当然,这是行不通的,因为我的边界实现方式不同.也许我可以将列表(上、右、下、左)添加到我的边框实现中,这样我就可以保持相同的名称.但我还没有检查过.

                  在 python 和 kv 中将我的边框的命名更改为边框修复了问题:

                  类 BorderBehavior(Widget):边框 = ObjectProperty(无)

                  现在看起来我想要它:

                  好的,现在我将检查它是否也适用于其他类(例如 Scatter、Widget、...).如果这行得通,我正在向 Kivy 发出拉取请求.

                  I'm trying to add a border to Kivy Buttons but it doesn't work as expected. For labels my implementation seems to be OK but for buttons it overrides/clears the standard look of the button.

                  How can I draw the border above the button with-out changing normal behavior? I'd like to implement it like the ButtonBehavior so I can add a border to every Kivy object with a canvas. I've called it BorderBehavior.

                  Styling dashed, dotted works only for line width of 1 because there is a bug in Kivy (see https://github.com/kivy/kivy/issues/2037) (Need to figure out what's wrong here later.)

                  I know that drawing a border is possible with a BorderImage but I'd like to add simple borders with-out an image.

                  Here is how it looks at the moment:

                  You can find my source code here (the labels can be dragged just for testing purposes to see that the border is always correctly positioned):

                  https://gist.github.com/AWolf81/c6796dc2049d9872b2df

                  解决方案

                  OK, I've found the fix. It was a naming conflict.

                  In the console log I saw that there is a problem at unpacking the border tuple in BorderImage of the button. Of course, that's not working because my border is implemented differently. Maybe I can add the list (top, right, bottom, left) to my border implementation so I can keep the same name. But I haven't checked that yet.

                  Changing the naming of my border to borders in python and in kv fixed the problem:

                  class BorderBehavior(Widget):
                      borders = ObjectProperty(None)
                  

                  Now it looks like I want it:

                  OK, now I'll check if it's working for other classes too (e.g. Scatter, Widget,...). If that's working I'm doing a pull request to Kivy.

                  这篇关于有没有一种简单的方法可以在没有图像的情况下为 Kivy 标签、按钮、小部件等添加边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Kivy 应用程序中获取文本输入值 下一篇:如何从 kivy 小部件画布中删除特定说明?

                  相关文章

                  最新文章

                  <small id='yr9E7'></small><noframes id='yr9E7'>

                  • <bdo id='yr9E7'></bdo><ul id='yr9E7'></ul>
                  <tfoot id='yr9E7'></tfoot>
                    <legend id='yr9E7'><style id='yr9E7'><dir id='yr9E7'><q id='yr9E7'></q></dir></style></legend>
                    <i id='yr9E7'><tr id='yr9E7'><dt id='yr9E7'><q id='yr9E7'><span id='yr9E7'><b id='yr9E7'><form id='yr9E7'><ins id='yr9E7'></ins><ul id='yr9E7'></ul><sub id='yr9E7'></sub></form><legend id='yr9E7'></legend><bdo id='yr9E7'><pre id='yr9E7'><center id='yr9E7'></center></pre></bdo></b><th id='yr9E7'></th></span></q></dt></tr></i><div id='yr9E7'><tfoot id='yr9E7'></tfoot><dl id='yr9E7'><fieldset id='yr9E7'></fieldset></dl></div>