Kivy App loads with other colors than defaults every launch (bug)

会有一股神秘感。 提交于 2019-12-11 17:57:41

问题


(Python 3.7.3 / Kivy 1.10.1 / Win10 patch 1809)

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.

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

1st attempt :

2nd attempt :

3rd attempt :

4th attempt :

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)

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

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

Then here is 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.


回答1:


OS - Windows 10

Uninstall Kivy & Dependencies

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

Installation

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

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.




回答2:


Got my answer thanks to inclement, installing this wheel below helped me to get rid of this bug. Thanks a lot !

Wheel for Python 3.7 64 bit : https://kivy.org/downloads/appveyor/kivy/Kivy-1.11.0.dev0-cp37-cp37m-win_amd64.whl

Other wheels : https://kivy.org/downloads/appveyor/kivy/

EDIT : Well, it worked for a moment, then the problem reappeared even with my original mytest.py, and I haven't done anything to Kivy's site-packages files after upgrading to Kivy 1.11.0.dev0. Is Kivy really suitable for developing stable apps or is it always that messy ? I really want it to work, Kivy looks interesting, but it doesn't look stable at all. I don't even know where to post now so I guess I'll edit this post until I get answers so I'll post answers afterwards.

EDIT 2 : Just a screenshot :



来源:https://stackoverflow.com/questions/56208785/kivy-app-loads-with-other-colors-than-defaults-every-launch-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!