我正在编写一个 Python 脚本,我要让它说上次更新:然后是它上次更新的时间,但我不确定如何
这是示例代码
from PIL import ImageDraw
import ctypes, time
import urllib
import manipulate
import datetime
font_size = 50
font_color = "red"
font = ImageFont.load_default()
img = Image.open('bg.bmp')
draw = ImageDraw.Draw(img)
time = datetime.datetime.now()
draw.text((650, 450),' CURRENT GRADES' )
draw.text((650, 500), 'Period 1: Geography -----------------------------')
draw.text((650, 550), 'Period 2: Francais-------------------------------')
draw.text((650, 600), 'Period 3: Science--------------------------------')
draw.text((650, 650), 'Period 4: P.E------------------------------------')
draw.text((650, 700), 'Period 5: Algebra 9------------------------------')
draw.text((650, 750), 'Period 6: LA-------------------------------------')
draw.text((650, 800), 'Last Updated:'(time))
draw = ImageDraw.Draw(img)
draw = ImageDraw.Draw(img)
img.save('mod_bg.bmp')
pathToBmp = "C:\Python27\mod_bg.bmp"
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, pathToBmp ,
0)
最后更新的地方是我需要时间来
当我尝试它时,我得到了这个错误
Traceback (most recent call last):
File "C:\Python27\Project.py", line 28, in <module>
draw.text((650, 800), 'Last Updated:'(time))
TypeError: 'str' object is not callable
如果有人可以帮忙,请做!谢谢!