Python3和Kivy:小部件的文本颜色在每次运行时均被随机设置为默认值

时间:2019-05-24 09:14:29

标签: python kivy

这是我的示例(代码相同,我运行了2次代码):

第一次屏幕:1

秒:2

它不依赖于代码。我到处都有同样的问题,但是无论如何,我将在此处留下示例代码:

from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout

class ExampleApp(App):
    def build(self):
        bl = GridLayout(cols = 3)
        bl.add_widget(Button(text = "button_0", font_size = 50))
        bl.add_widget(Button(text = "button_1", font_size = 50))
        bl.add_widget(Button(text = "button_2", font_size = 50))
        return bl

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

命令提示符:

[INFO   ] [Logger      ] Record log in C:\Users\User\.kivy\logs\kivy_19-05-24_51.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.5.0 - Build 23.20.16.5001'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) UHD Graphics 630'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50 - Build 23.20.16.5001'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available

p.s。两次都一样

感谢

0 个答案:

没有答案