<legend id='MzIvb'><style id='MzIvb'><dir id='MzIvb'><q id='MzIvb'></q></dir></style></legend>

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

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

    2. <tfoot id='MzIvb'></tfoot>
    3. 有没有一种简单的方法可以在没有图像的情况下为 Kivy 标签、按钮、小部件等添加边框?

      Is there a simple way to add a border to Kivy Labels, Buttons, Widgets etc. with-out images?(有没有一种简单的方法可以在没有图像的情况下为 Kivy 标签、按钮、小部件等添加边框?)

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

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

            <tfoot id='hyoJ2'></tfoot>
                <tbody id='hyoJ2'></tbody>

              • 本文介绍了有没有一种简单的方法可以在没有图像的情况下为 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 标签、按钮、小部件等添加边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                Centering an object in Kivy(在 Kivy 中将对象居中)
                How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)

                • <bdo id='rP89z'></bdo><ul id='rP89z'></ul>
                  <tfoot id='rP89z'></tfoot>

                    <legend id='rP89z'><style id='rP89z'><dir id='rP89z'><q id='rP89z'></q></dir></style></legend>

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

                        1. <small id='rP89z'></small><noframes id='rP89z'>