Search code examples
pythondownloadpackagekivypong

Where to download kivy 1.0.9?


I've been following this tutorial: http://kivy.org/docs/tutorials/pong.html. I'm trying to run the program after finishing the steps under "Add Simple Graphics", but instead of a black screen with a white line and two zeroes, I just get a black screen. I copy pasted the code and have the files in the same directory. In the shell it says that it can't find pong.kv in pong_directory, but I checked twice and it is there.

[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\rabbitrabbit\.kivy\logs\kivy_14-08-21_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
[DEBUG             ] [Window      ] Display driver windib
[DEBUG             ] [Window      ] Actual window size: 800x604
[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
[INFO              ] [Context     ] Reloading graphics data...
[DEBUG             ] [Context     ] Collect and flush all garbage
[DEBUG             ] [Context     ] Reload textures
[DEBUG             ] [ImagePygame ] Load <C:\Python33\lib\site-packages\kivy\data\glsl\default.png>
[DEBUG             ] [Context     ] Reload vbos
[DEBUG             ] [Context     ] Reload vertex batchs
[DEBUG             ] [Context     ] Reload shaders
[DEBUG             ] [Shader      ] Fragment compiled successfully
[DEBUG             ] [Shader      ] Vertex compiled successfully
[DEBUG             ] [Context     ] Reload canvas
[INFO              ] [Context     ] Reloading done in 0.0850s

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"

Solution

  • You don't need (or want!) kivy 1.0.9, that's really old - it's only a minimum requirement. The pong tutorial should work fine.

    It's not clear what your actual problem is - what part of the tutorial are you running (you could paste the code)? The first runnable example should give a black window (there's no other code there), while the second uses a pong.kv file that is not found in your log.