在Kivy中发布打开的.png文件

时间:2014-09-05 20:53:36

标签: python kivy

尝试使用kivy.garden.mapview,显然这仍然是一项正在进行的工作,但想知道问题是否可能在kivy / core / image / img_pygame.py

kivy / pygame支持.png图片吗?

-B

   [DEBUG             ] [ImagePygame ] Load <cache\osm_18_131070.5_131070.0.png>
   [WARNING           ] [Image       ] Unable to load image <cache\osm_18_131070.5_131070.0.png>
   [INFO              ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "C:\Users\Brendan\Documents\oldfiles\ShorePark.py", line 306, in <module>
     ShorePark().run()
   File "C:\Python34\lib\site-packages\kivy\app.py", line 792, in run
     runTouchApp()
   File "C:\Python34\lib\site-packages\kivy\base.py", line 481, in runTouchApp
     EventLoop.window.mainloop()
   File "C:\Python34\lib\site-packages\kivy\core\window\window_pygame.py", line 381, in mainloop
     self._mainloop()
   File "C:\Python34\lib\site-packages\kivy\core\window\window_pygame.py", line 287, in _mainloop
     EventLoop.idle()
   File "C:\Python34\lib\site-packages\kivy\base.py", line 321, in idle
     Clock.tick()
   File "C:\Python34\lib\site-packages\kivy\clock.py", line 422, in tick
     self._process_events()
   File "C:\Python34\lib\site-packages\kivy\clock.py", line 537, in _process_events
     if event.tick(self._last_tick) is False:
   File "C:\Python34\lib\site-packages\kivy\clock.py", line 309, in tick
     ret = callback(self._dt)
   File "C:\Python34\lib\site-packages\gardenMapView\mapview\downloader.py", line 79, in _check_executor
     callback(*args)
   File "C:\Python34\lib\site-packages\gardenMapView\mapview\view.py", line 83, in set_source
     self.source = cache_fn
   File "instructions.pyx", line 337, in kivy.graphics.instructions.VertexInstruction.source.__set__ (kivy\graphics\instructions.c:6497)
   File "context_instructions.pyx", line 360, in kivy.graphics.context_instructions.BindTexture.source.__set__ (kivy\graphics\context_instructions.c:7150)
   File "C:\Python34\lib\site-packages\kivy\core\image\__init__.py", line 442, in __init__
     self.filename = arg
   File "C:\Python34\lib\site-packages\kivy\core\image\__init__.py", line 631, in _set_filename
     mipmap=self._mipmap, nocache=self._nocache)
   File "C:\Python34\lib\site-packages\kivy\core\image\__init__.py", line 371, in load
     im = loader(filename, **kwargs)
   File "C:\Python34\lib\site-packages\kivy\core\image\__init__.py", line 150, in __init__
     self._data = self.load(filename)
   File "C:\Python34\lib\site-packages\kivy\core\image\img_pygame.py", line 42, in load
     im = pygame.image.load(filename)
 pygame.error: Unsupported image format

编辑:

使用我自己的Python发行版,最终让它发挥作用。

似乎问题是mscv编译器正在寻找vcvarsamd64.bat,但它不存在。

使用以下解决方案:Errors while building/installing C module for Python 2.7

然后我将所有glew标题和libs复制到相应的包含文件中,我终于使用pip install kivy正确安装了kivy

2 个答案:

答案 0 :(得分:0)

应该支持png,我不确定问题是什么。可能是pygame提供者不能做png而你缺少一个更好的提供者,但这似乎不太可能。

您是否可以运行mapview附带的示例?例如其github repo的examples目录中的simple_map.py。

答案 1 :(得分:0)

结果我试图将 vector mbtiles加载到Mapview中,但它不支持。它确实支持 raster mbtiles,例如https://docs.djangoproject.com/en/1.8/ref/models/querysets/#django.db.models.query.QuerySet.first