1

I defined CustomButton and CustomWidget in custom.kv file, defined empty CustomWidget class in main.py, but when I run the program, window is all black, there is no button. What am I doing wrong?

main.py

import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button

class CustomWidget(Widget):
    pass

class CustomButton(Button):
    pass

class MyApp(App):
    def build(self):
            return CustomWidget()


application = MyApp()
application.run()

custom.kv

#:kivy 1.10.1

<CustomButton@Button>:
    font_size: 32
    color: .5, .5, 0, 1
    size: 150, 50
    background_normal: ''
    background_down: 'background.png'
    background_color: .88, .88, .88, 1

<CustomWidget>:
    CustomButton:
        text: 'Random'
        pos: root.x, 200

output:

black window

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
tomaszu
  • 73
  • 7

0 Answers0