本文整理汇总了Python中World.World.ca方法的典型用法代码示例。如果您正苦于以下问题:Python World.ca方法的具体用法?Python World.ca怎么用?Python World.ca使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.ca方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import ca [as 别名]
"""
# Code used to calculate dementions of left approx-equilateral triangle
end_count = 20000
a = 1
while a < end_count:
c = math.sqrt(5*(a**2))
c_int = int(c)
if (abs(c-c_int) <= 5) and (abs(c_int - (2*a)) <= 5) : print a, c
a += 1
"""
from World import World
width = 250
height = 250
world = World()
canvas = world.ca(width=width, height=height, background='grey')
left_triangle = [[-56,25], [0, 0], [-56, -25]]
canvas.polygon(left_triangle, fill='blue')
top_polygon = [[-56,25], [56,25], [56,0], [0,0]]
canvas.polygon(top_polygon, fill='white')
bottom_polygon = [[-56,-25], [56,-25], [56,0], [0,0]]
canvas.polygon(bottom_polygon, fill='red')
world.mainloop()
示例2: make_color_dict
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import ca [as 别名]
# I need 28 by 28 grid to fit all 753 colors!
#
"""
if __name__ == '__main__':
color_dict = make_color_dict()
for name, rgb in color_dict.iteritems():
print rgb, name
"""
from World import World
from exc15_4 import draw_rectangle
width = 750
height = 750
world = World()
canvas = world.ca(width=width, height=height, background='white')
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)
###
示例3: World
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import ca [as 别名]
from World import World
world = World()
world.mainloop()
canvas = world.ca(width=500, height=500, background="white")
bbox = [[-150, -100], [150, 100]]
canvas.rectangle(bbox, outline="black", width=2, fill="green4")
canvas.circle([-25, 0], 70, outline=None, fill="red")