2016-02-04 56 views
1

我正試圖顯示從另一個網站使用kv語言拉出的圖像('iphoto')。我收到一個圖像文件無法讀取的錯誤,但是我可以從錯誤中複製圖像地址,並在瀏覽器中拉出圖像,沒有任何問題。我究竟做錯了什麼?讀取kv時出錯圖像來源

信息:

Python 3.4

Kivy 1.9.1

相關的Python:( 'pet_photo' 是http地址從XML SOAP響應拉動)

class ScrollerApp(App): 
    for child in root.iter('pet_id'): 
     iphoto = child.find('pet_photo').text 
    def build(self): 
     self.load_kv('Scroller.kv') 
     return TheBox() 

if __name__ == '__main__': 
    Window.fullscreen = 'auto' 
    ScrollerApp().run() 

相關KV :

<TheBox>: 
    FloatLayout: 
     FloatLayout: 
      size: 810, 1080 
      pos_hint: {'center_x': .21}   
      Image: 
       size_hint: None, None 
       size: 790, 770 
       pos_hint: {'center_x': .5, 'center_y': .64} 
       allow_stretch: True 
       keep_ratio: True 
       source: str(app.iphoto) 

的錯誤:

[ERROR ] [Image ] Error reading file http://sms.petpoint.com/sms/photos/615/ba451ef8-3dd5-428f-b437-cca6521024d0.jpg

回答

0

嘗試的AsyncImage。 AsyncImage Docs

<TheBox>: 
    FloatLayout: 
     FloatLayout: 
      size: 810, 1080 
      pos_hint: {'center_x': .21}   
      AsyncImage: 
       size_hint: None, None 
       size: 790, 770 
       pos_hint: {'center_x': .5, 'center_y': .64} 
       allow_stretch: True 
       keep_ratio: True 
       source: str(app.iphoto)