本文整理汇总了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)