I don't know what is happening in the code, to me it looks all fine but whenever running the code it is showing a black screen. When I change the return type to 'Builder.load_file' it is giving an err0r of:
[CRITICAL] [Application ] No window is created. Terminating application run.
[INFO ] [ProbeSysfs ] device match: /dev/input/event5
[INFO ] [MTD ] Read event from </dev/input/event5>
[INFO ] [Base ] Start application main loop
[ERROR ] [Base ] No event listeners have been created
[ERROR ] [Base ] Application will leave
Here is the code for main.py file:
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
class MyGLayout(BoxLayout):
pass
class MainApp(App):
def build(self):
return Builder.load_file('timer0.kv')
if __name__=='__main__':
MainApp().run()
here is the code for .kv file:
#:kivy 2.1.0
<MyGLayout>:
orientation:'vertical'
size:root.width,root.height
spacing:20
padding:20
Label:
text:'Hello name!!'
If anyone knows what is wrong with the code, please guide.
In your .kv file, you should remove the <>.
Use:
MyGLayout:
orientation:'vertical'
size:root.width,root.height
spacing:20
padding:20
Label:
text:'Hello name!!'