Kivy App每次启动时都会加载除默认颜色以外的其他颜色(错误) [英] Kivy App loads with other colors than defaults every launch (bug)

查看:218
本文介绍了Kivy App每次启动时都会加载除默认颜色以外的其他颜色(错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(Python 3.7.3/Kivy 1.10.1/Win10补丁1809)

(Python 3.7.3 / Kivy 1.10.1 / Win10 patch 1809)

您好,感谢您抽出一些时间来阅读我的内容. Kivy加载我的应用程序文本时使用的颜色与默认颜色不同,我遇到了问题.所述文字应为白色(默认颜色),但有时在我关闭然后重新启动应用程序时会随机显示为灰色或接近黑色.昨天我没有这个问题,今天就开始发生.

Hi, thanks for taking some time to read me. I'm having an issue with Kivy loading my app's text with different colors than the default ones. The said text should be white (default color), but sometimes randomly appears grey, or almost black when I close then relaunch the app. I didn't have this issue yesterday, it has started to happen today.

以下是运行mytest.py的各种尝试的屏幕截图,除了关闭并重新启动应用程序外,我只做了其他事情:

Here are screenshots of different attempts to run mytest.py, I didn't do anything more than closing and relaunching the app :

第一次尝试:

第二次尝试:

第三次尝试:

第四次尝试:

此外,当我启动我的应用程序时,控制台上还会打印一些消息:

Also, some message got printed in the console when I launched my app :

ANOMALY: use of REX.w is meaningless (default operand size is 64)

除了通过Pip卸载/重新安装Kivy之外,我没有尝试解决任何问题,因为我不知道先从哪里开始,我对Kivy和OpenGL都是陌生的.

I haven't tried anything to solve the problem except uninstalling/reinstalling Kivy via Pip because I don't know where to start first, I'm new to both Kivy and OpenGL (not to Python 3).

这里是mytest.py:

from kivy.app import App
from kivy.properties import ObjectProperty
from kivy.uix.textinput import TextInput
from kivy.uix.widget import Widget

class MyGrid(Widget):
    button_1 = ObjectProperty(None)

    def print_erase_all_text(self, text_input:TextInput):
        if text_input.text:
            print(text_input.text)
        text_input.select_all()
        text_input.delete_selection()

class MyTestApp(App):
    def build(self):
        return MyGrid()

if __name__ == '__main__':
    MyTestApp().run()

然后是mytest.kv:

<MyGrid>
    textinput_1: textinput_1

    GridLayout:
        cols: 3
        size: root.width, root.height

        Label:
            text: "Text 1"

        TextInput:
            id: textinput_1
            multiline: False

        Button:
            text: "Print & erase"
            on_release:
                root.print_erase_all_text(textinput_1)

        Label:
            text: "Text 2"

        TextInput:
            multiline: False

        Button:
            text: "Do nothing"

        Label:
            text: "Text 3"

        TextInput:
            multiline: False

        Button:
            text: "Do nothing"

如您所见,我没有在代码中更改任何对象的颜色设置,因此除默认的白色外,其他任何颜色均不得显示文本.

As you can see, I didn't change any color setting of any object in my code, so no text should appear in any other color than the default white.

我认为这就是我所拥有的全部信息.如果您还需要其他任何功能,请问我,我会尽力而为.再次感谢您阅读我.

I think that's all the info I have. If you need anything more just ask me and I'll do my best. Thanks again for reading me.

推荐答案

OS-Windows 10

卸载Kivy&依赖关系

python -m pip uninstall kivy
python -m pip uninstall kivy.deps.sdl2
python -m pip uninstall kivy.deps.glew
python -m pip uninstall kivy.deps.gstreamer

安装

python -m pip install --upgrade pip wheel setuptools
python -m pip install kivy.deps.sdl2==0.1.18
python -m pip install docutils pygments pypiwin32 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
python -m pip install kivy.deps.angle
python -m pip install kivy

验证SDL2-0.1.18

检查 kivy.deps.sdl2 版本是否为0.1.18,即文件夹名称 kivy.deps.sdl2-0.1.18.dist-info ,在C:\Users\username\AppData\Local\Programs\Python\Python37\Lib\site-packages中.将 username 替换为您的用户名.

Verify SDL2 - 0.1.18

Check that kivy.deps.sdl2 is version 0.1.18 i.e. folder name, kivy.deps.sdl2-0.1.18.dist-info, in C:\Users\username\AppData\Local\Programs\Python\Python37\Lib\site-packages. Replace username with your user-name.

这篇关于Kivy App每次启动时都会加载除默认颜色以外的其他颜色(错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆