本文整理汇总了Python中World.World.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python World.mainloop方法的具体用法?Python World.mainloop怎么用?Python World.mainloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.mainloop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_color_dict
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import mainloop [as 别名]
if __name__ == '__main__':
# there are less than 28**2 total colors
tot_colors_root = 28
swath_width = width/tot_colors_root
swath_height = height/tot_colors_root
# define upper left hand corner x and y
quadrant_x = -(width/2)
quadrant_y = height/2
color_dict = make_color_dict()
count = 1
colors_count = len(color_dict)
###
print colors_count
for name, rgb in color_dict.iteritems():
row = (count/tot_colors_root)
column = (count%tot_colors_root)
# bbox =[[lower left corner], [upper right corner]]
ll_x = quadrant_x + (column * swath_width)
ll_y = quadrant_y - (swath_height+(row * swath_height))
ur_x = quadrant_x + (column * swath_width) + swath_width
ur_y = quadrant_y - (row*swath_height)
bbox = [[ll_x, ll_y], [ur_x, ur_y]]
draw_rectangle(canvas, bbox, rgb)
print count, row, column, rgb, name
count += 1
print colors_count
world.mainloop()