本文整理汇总了Python中Graphics.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.draw方法的具体用法?Python Graphics.draw怎么用?Python Graphics.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: grayscale
# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import draw [as 别名]
def grayscale(imageName):
win = g.GraphWin()
image = g.Image(point(0, 0), imageName)
# for each row in the image:
for rown in image:
for column in image:
r, g, b = # get pixel information for current row and column
brightness = int(round((0.299 * r) + (0.587 * g) + (0.114 * b)))
pixel_color = color_rgb(brightness, brightness, brightness)
# update the image # to see progress row by row
for row in image:
for column in image:
r, g, b = g.getPixel(row, column)
brightness = int(round(0.299 * r + 0.587 * g + 0.114 * b))
g.color_rgb(brightness, brightness, brightness)
g.draw(win)