Python kivy中的背景图像未从crontab加载

Python kivy中的背景图像未从crontab加载,python,cron,kivy,Python,Cron,Kivy,我用以下代码编写了一个python程序: class MainScreen(Widget): res = True plastic = True paper = True def __init__(self,**kwargs): super(MainScreen,self).__init__(**kwargs) self.animate() class Warn(App): def build(self):

我用以下代码编写了一个python程序:

class MainScreen(Widget):
    res = True
    plastic = True
    paper = True 
    def __init__(self,**kwargs):
        super(MainScreen,self).__init__(**kwargs)
        self.animate()

class Warn(App):


    def build(self):
        return MainScreen()
和.kv文件:

<MainScreen>:
    FloatLayout:
        size: root.width, root.height
        canvas.before:
            Rectangle:
                pos: self.pos
                size: self.size
                source: "resources/bg.jpg"
        Label:
            text: "Do the thing"
            color: 0,0,0,0.8
            font_size: 100 
            pos_hint: {"center_x":0.50,"center_y":0.90}
        Label:
            text: "blabla" 
            font_size: 47   
            pos_hint: {"center_x":0.71,"center_y":0.37} 
        Image:
            id: img1
            source: "resources/img.jpg" 
            pos_hint: {"center_x":0.71,"center_y":0.50} 
:
浮动布局:
尺寸:根.宽度,根.高度
在以下情况之前:
矩形:
pos:self.pos
大小:self.size
资料来源:“参考资料/bg.jpg”
标签:
文本:“做那件事”
颜色:0,0,0,0.8
字体大小:100
pos_提示:{“center_x”:0.50,“center_y”:0.90}
标签:
文字:“布拉布拉”
字号:47
pos_提示:{“center_x”:0.71,“center_y”:0.37}
图片:
id:img1
资料来源:“参考资料/img.jpg”
pos_提示:{“center_x”:0.71,“center_y”:0.50}
当我手动运行这个程序时(在命令行中键入python3main.py),它运行良好,背景图像显示出来

但是,当我在crontab-e中放入以下行时: 10 17***python3/home/pi/project/main.py
代码运行,但未显示背景图像(bg.jpg)。程序的其余部分工作正常,即使另一个图像(img.jpg)与bg.jpg位于同一地图中,也能正常加载。我最终修复了它。由于某种原因,更改图像大小和图像类型(.jpg与png)解决了问题


谢谢大家的帮助

我猜图像小部件比矩形画布指令具有更高级的文件路径分辨率。请尝试在脚本开始时将当前目录设置为您的应用程序目录。不幸的是,这也不起作用…然后发布一个最小的可运行示例,并使用我的部分代码的cop粘贴来编辑问题。@Bous use fullpath of.jpgs