Jump to content
  • Advertisement
Sign in to follow this  

Problem With Simple Kivy Pong Tutorial

This topic is 1419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been following this tutorial: http://kivy.org/docs/tutorials/pong.html, and I've run into a problem. When I get to the "Add Simple Graphics" section and try to run the program, instead of showing a black screen with the white line and two zeroes, it just shows the black screen. I have the files main.py and pong.kv both in the directory pong_directory.py in Windows(C:). According to what appears in the shell(below), Kivy can't find pong.kv. I've checked several times, and I know it's there so if anyone knows what's going on, please respond. I've been trying to figure this out for a while, but I haven't come up with anything. Feedback is greatly appreciated.


from kivy.app import App
from kivy.uix.widget import Widget

class pongGame(Widget):

class pongApp(App):
    def build(self):
        return pongGame()

if __name__ == '__main__':


#:kivy 1.0.9

            pos: self.center_x - 5, 0
            size: 10, self.height
        font_size: 70  
        center_x: root.width / 4
        top: root.top - 50
        text: "0"
        font_size: 70  
        center_x: root.width * 3 / 4
        top: root.top - 50
        text: "0"


[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\rabbitrabbit\.kivy\logs\kivy_14-08-22_2.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[DEBUG             ] [App         ] Loading kv <C:\pong_directory.py\pong.kv>
[DEBUG             ] [App         ] kv <C:\pong_directory.py\pong.kv> not found
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[INFO              ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[DEBUG             ] [Window      ] Display driver windib
[DEBUG             ] [Window      ] Actual window size: 800x600
[DEBUG             ] [Window      ] Actual color bits r8 g8 b8 a0
[DEBUG             ] [Window      ] Actual depth bits: 24
[DEBUG             ] [Window      ] Actual stencil bits: 8
[DEBUG             ] [Window      ] Actual multisampling samples: 2
GLEW initialization succeeded
[INFO              ] [GL          ] OpenGL version <b'2.1.2'>
[INFO              ] [GL          ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO              ] [GL          ] OpenGL renderer <b'Quadro NVS 110M/PCI/SSE2'>
[INFO              ] [GL          ] OpenGL parsed version: 2, 1
[INFO              ] [GL          ] Shading version <b'1.20 NVIDIA via Cg compiler'>
[INFO              ] [GL          ] Texture max size <4096>
[INFO              ] [GL          ] Texture max units <16>
[DEBUG             ] [Shader      ] Fragment compiled successfully
[DEBUG             ] [Shader      ] Vertex compiled successfully
[DEBUG             ] [ImagePygame ] Load <C:\Python33\lib\site-packages\kivy\data\glsl\default.png>
[INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO              ] [OSC         ] using <thread> for socket
[DEBUG             ] [Base        ] Create provider from mouse
[DEBUG             ] [Base        ] Create provider from wm_touch
[DEBUG             ] [Base        ] Create provider from wm_pen
[INFO              ] [Base        ] Start application main loop
[INFO              ] [Base        ] Leaving application in progress...

Thank you for taking the time to read this.

Share this post

Link to post
Share on other sites

Hello mate,


I spot one thing immediately wrong

The shell clearly shows "Start application main loop" and then "Leaving application...".


So yes, your code syntax and logic is fine. But somethings making Kivy leave the main loop. That something is that it isn't actually told anything to do.


You have a problem with your pongApp(App) class. pongGame is a class itself, so you need to create an instance, or object, from it first and return that.

Add something like this to the build function:

game = pongGame()
return game

And I hope that has solved the issue, let me know if not.



Share this post

Link to post
Share on other sites

Hi Ilmiont, thanks for responding. The "Leaving application" being included was a mistake on my part, I closed the program and then copied what was in the shell. That doesn't appear when I run the program without closing it. I added what you suggested to the the build function, but there wasn't any difference.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!