Kivy Python有问题吗?功能错误和图像错误

时间:2015-09-01 19:40:23

标签: python image methods kivy

我正在尝试使用Kivy来构建应用。 这是代码:

from kivy.app import App 
from kivy.uix.widget import Widget 
from kivy.graphics import Color, Ellipse, Line 
from kivy.core.window import Window  

class Background_Animation(Widget): 

    def __init__(self, imageStr, **kwargs):
        super(Background_Animation, self).__init__(**kwargs) 
        self.__init__= __init__(self, imageStr, **kwargs)
        with self.canvas : 
            self.size= (Window.width * 0.002 * 25, Window.height *0.002 * 25 ) 

            # bind the fbo to the current opengl context 
            self.bind(pos == self.update_graphics_pos) 

            # x center position 
            self.x = self.center_x 

            # declare the image 
            imageStr= Image("~/Downloads/psychTREE.jpg", **kwargs) 

            # y center position 
            self.y = self.center_y 

            self.pos= (self.x, self.y)

            self.image= self.pos 

            return image

    def build(self):
        self.build = build
        run =  __init__(self, imageStr, **kwargs) 
        return run 



    if __name__ == "__main__" :
        build(self, imageStr, **kwargs).run() 

当我尝试运行代码时,它表示名称“build”未定义。关于如何解决这个问题的任何想法?另外,我如何让图像出现在gui中?

0 个答案:

没有答案