【问题标题】:Where to download kivy 1.0.9?在哪里下载kivy 1.0.9?
【发布时间】:2014-10-15 12:29:51
【问题描述】:

我一直在关注本教程:http://kivy.org/docs/tutorials/pong.html。在完成“添加简单图形”下的步骤后,我尝试运行该程序,但不是带有白线和两个零的黑屏,而是黑屏。我复制粘贴了代码并将文件放在同一目录中。在shell中它说它在pong_directory中找不到pong.kv,但我检查了两次,它就在那里。

[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"

【问题讨论】:

    标签: python download package kivy pong


    【解决方案1】:

    您不需要(或想要!)kivy 1.0.9,它真的很旧 - 它只是最低要求。乒乓教程应该可以正常工作。

    不清楚您的实际问题是什么 - 您正在运行教程的哪一部分(您可以粘贴代码)?第一个可运行示例应该给出一个黑色窗口(那里没有其他代码),而第二个使用在您的日志中找不到的 pong.kv 文件。

    【讨论】:

    • from kivy.properties import NumericProperty, ReferenceListProperty,\ ObjectProperty 会在python 3 工作吗?
    • 是的,所有的kivy都支持python3。
    • 哦,我不知道:P。我正在“添加简单图形”下运行教程的一部分。根据教程,在将 pong.kv 保存在同一目录中的同时运行 main.py 应该会导致黑屏出现一条白线和两个零。我就是黑屏。代码已添加。
    • 记录器告诉你'[DEBUG] [App] kv not found'。你相信这个文件应该存在吗?回溯的哪一部分出错了?
    • 我检查了 pong.kv 确实存在,它在 pong_directory.py 中。我应该把它保存在 Windows(C:) 以外的地方吗?
    猜你喜欢
    • 2012-07-09
    • 2012-06-18
    • 2015-08-26
    • 1970-01-01
    • 1970-01-01
    • 2015-03-21
    • 2017-02-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多