Reputation: 1
I was working on the pong tutorial provided by the Kivy documentation website, after making the .kv file where I implemented the centered rectangle, and the numbers(labels), I ran the code, but the screen was just black. I have looked all over youtube, and asked chatGPT, but cannot find the source of my issue. The code:
main.py:
from kivy.app import App
from kivy.uix.widget import Widget
class PongGame(Widget):
pass
class PongApp(App):
def build(self):
return PongGame()
if __name__ == '__main__':
PongApp().run()
pong.kv:
#:kivy 1.0.9
<PongGame>:
canvas:
Rectangle:
pos: self.center_x - 5, 0
size: 10, self.height
Label:
font_size: 70
center_x: root.width / 4
top: root.top - 50
text: "0"
Label:
font_size: 70
center_x: root.width * 3 / 4
top: root.top - 50
text: "0"
I have checked my directory for both files, and both files are in the same folder. The names are also right, as I even copy and pasted from the kivy website and double checked. It should show 2 0s on either side of a rectangle which is centered in the middle. Also all indentations are correct for the kv and python files.
Upvotes: 0
Views: 19