本文整理汇总了Python中maze.Maze.as_image方法的典型用法代码示例。如果您正苦于以下问题:Python Maze.as_image方法的具体用法?Python Maze.as_image怎么用?Python Maze.as_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maze.Maze
的用法示例。
在下文中一共展示了Maze.as_image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: maze
# 需要导入模块: from maze import Maze [as 别名]
# 或者: from maze.Maze import as_image [as 别名]
def maze(request, size):
'''
creates a maze. accepts a 'size' param on the querysting
Generates an image that is sent as the whole reponse
Should experiment with displaying a html page within which an image
is displayed, the source of which is this
'''
try:
size = int(size)
if size > 30:
size = 30
m = Maze(size, size)
image = m.as_image()
response = HttpResponse(mimetype="image/png")
image.save(response, "PNG")
return response
except:
pass