2016-05-16 120 views
2

當我嘗試設置我的烏龜屏幕背景我得到這個錯誤:蟒蛇Tkinter的海龜屏幕背景

enter image description here

這是部分代碼:

sc=turtle.Screen() 
    turtle.setworldcoordinates(0, 0, 1000,1000) 
    sc.bgpic('images.jpg') 

是的圖像保存在相同的文件名下,我在代碼中調用它。

+1

看起來你的''images.jpg''文件可能已損壞。嘗試在不同的程序中打開它。 – martineau

回答

0

每烏龜文檔,bgpic()只接受GIF文件,JPEG不是:

turtle.bgpic(picname=None)

Parameters: picname – a string, name of a gif-file or "nopic", or None

Set background image or return name of current backgroundimage. If picname is a filename, set the corresponding image as background. If picname is "nopic", delete background image, if present. If picname is None, return the filename of the current backgroundimage.