简体   繁体   English

Kivy 在无线网络上返回黑屏

[英]Kivy returning black screen on wi

I have been developing a mobile app in Kivy.我一直在用 Kivy 开发一个移动应用程序。 However, I deleted something in the .py file (cant remember what) and now I cannot get anything other than a black screen when I run the program.但是,我删除了 .py 文件中的一些内容(不记得是什么),现在我在运行程序时除了黑屏之外什么都没有。 I made the .py and .kv files as simple as possible to reduce points of failures and it still doesnt work.我使 .py 和 .kv 文件尽可能简单以减少故障点,但它仍然不起作用。

Here is the .py file:这是 .py 文件:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.text import LabelBase
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from time import strftime
from kivy.uix.widget import Widget
from kivy.uix.gridlayout import GridLayout
from kivy import Config
Config.set('graphics', 'multisamples', '0')




class Anasayfa(Widget):
    pass


kv = Builder.load_file(r"C:\Users\Casper\Desktop\my.kv")
class myApp(App):
    def Build(self):
    
        return (kv)
   
if __name__ == "__main__":
    
    myApp().run()

There are some unnecessary stuff on import section, they are from the development of the actual app.导入部分有一些不必要的东西,它们来自实际应用程序的开发。

Here is the .kv file:这是 .kv 文件:

<Anasayfa>
    GridLayout:
        cols:1      
        Label:
            text:"Coming soon"
            color: 1,1,1,1

Thats all, I made both files dead simple and they still dont work.就是这样,我使这两个文件变得非常简单,但它们仍然不起作用。 There are no error messages, just a black screen and a mouse cursor.没有错误消息,只有黑屏和鼠标光标。 The black screen is in full screen as well, but widgets didnt cover the screen when things did work(think of it like viewing a phone screen on a laptop screen).黑屏也是全屏显示,但是当事情正常运行时小部件没有覆盖屏幕(就像在笔记本电脑屏幕上查看手机屏幕一样)。 Here is the event log:这是事件日志:

[INFO   ] [Logger      ] Record log in C:\Users\Casper\.kivy\logs\kivy_20-08-26_13.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\Casper\anaconda3\envs\CasperEnv\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\Casper\anaconda3\envs\CasperEnv\python.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (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 25.20.100.6373'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 520'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50 - Build 25.20.100.6373'>
[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
[INFO   ] [Base        ] Leaving application in progress...
[INFO   ] [WindowSDL   ] exiting mainloop and closing.

I would be grateful if someone can tell me what is wrong, because I have no idea what is wrong here.如果有人能告诉我出了什么问题,我将不胜感激,因为我不知道这里出了什么问题。 Thank you.谢谢你。

Your kv file does not create a root widget, it only creates a rule.您的kv文件不会创建根小部件,它只会创建规则。 You can change:你可以改变:

<Anasayfa>

to:到:

Anasayfa:

so that it creates a root widget.以便它创建一个根小部件。

Another problem is your myApp definition.另一个问题是您的myApp定义。 It should have a build() method, not a Build() method.它应该有一个build()方法,而不是Build()方法。 Likely just a typo.可能只是一个错字。

what about folks who still can't get anything to display on the screen?那些仍然无法在屏幕上显示任何内容的人呢?

GridLayout: cols:1 size: root.width, root.height GridLayout: cols:1 大小: root.width, root.height
 GridLayout: cols:2 Label: Text: "username" TextInput: multiline:False Label: Text: "password" TextInput: multiline:False Button: text: "confirm"#then save it and run the code

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM