本文整理匯總了Python中Img.gen方法的典型用法代碼示例。如果您正苦於以下問題:Python Img.gen方法的具體用法?Python Img.gen怎麽用?Python Img.gen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Img
的用法示例。
在下文中一共展示了Img.gen方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SendPic
# 需要導入模塊: import Img [as 別名]
# 或者: from Img import gen [as 別名]
def SendPic(command):
global commands
messagelist = []
if command.user in log:
userhist = log[command.user]
messagelist.append(userhist[-2][1])
messagelist.append(userhist[-1][0])
messagelist.append(userhist[-1][1])
else:
messagelist.append("Play the game first!!!")
image = Img.gen(messagelist)
try:
image.save("123.png")
except IOError:
print("cannot convert")
try:
api.update_with_media(filename = "123.png", status = "Here is a highlight from @" + command.user)
del commands[0] #remove command from queue. happens after posting, so if there is an error it stays in
print('POSTED pic to ' + command.user)
f = open("last.txt", "w")
f.write(str(command.id))
f.close()
#do not update the log when posting a highlight. only keeps track of actual game commands.
except tweepy.TweepError as e:
print "Error trying to post status: " + str(e.reason)