Reputation: 4723
I am trying to do some cross platform testing. Here is a working code for Windows:
main.py
#!/usr/bin/kivy
import kivy
kivy.require('1.0.6')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
class MatrixCalcLayout(BoxLayout):
pass
class ConfusionMatrixCalc_v3App(App):
def build(self):
return MatrixCalcLayout()
if __name__=='__main__':
ConfusionMatrixCalc_v3App().run()
ConfusionMatrixCalc_v3.kv
#:kivy 1.0
#:import kivy kivy
<MatrixCalcLayout>:
orientation: 'vertical'
BoxLayout:
Button:
BoxLayout:
Button:
BoxLayout:
Button:
When I try to run it on Ubuntu, it does load up and show the kivy canvas, but it's just a blank (black) screen as if it doesn't link to the .kv file.
Edited: Corrected the .kv file name
Upvotes: 1
Views: 728
Reputation: 2414
According to the kivy docs:
Kivy looks for a Kv file with the same name as your App class in lowercase, minus “App” if it ends with ‘App’ e.g:
You could change the .kv file to confusionmatrixcalc_v3.kv
or provide it explicitly when calling run()
if __name__=='__main__':
ConfusionMatrixCalc_v3App(kv_file="ConfusionMatrixCalc.kv").run()
Upvotes: 1
Reputation: 5405
You need to eiter load the kv file with Builder:
Builder.load_file("ConfusionMatrixCalc.kv")
Or change your App class name from ConfusionMatrixCalc_v3App
to ConfusionMatrixCalcApp
Upvotes: 1