本文整理汇总了Python中Point.Point.numPoints方法的典型用法代码示例。如果您正苦于以下问题:Python Point.numPoints方法的具体用法?Python Point.numPoints怎么用?Python Point.numPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point.Point
的用法示例。
在下文中一共展示了Point.numPoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Point
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import numPoints [as 别名]
#!/usr/bin/env python3
# points.py - Point program
from Point import Point
p1 = Point(5, 5) # Point at (5, 5)
p1.down() # move down
p1.right() # move right
print("Point 1 at:", p1.getX(), p1.getY())
p2 = Point(10, 20) # Point at (10, 20)
p2.move(30, 40) # move to (30, 40)
print("Point 2 at:", p2.getX(), p2.getY())
print(Point.numPoints(), "Points")
del p1, p2 # delete Point objects
print(Point.numPoints(), "Points")
#################################################
#
# $ points.py
# Point 1 at: 6 4
# Point 2 at: 30 40
# 2 Points
# 0 Points
#
示例2: Point
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import numPoints [as 别名]
#!/usr/bin/env python3
# pixels.py - Pixels and Points program
from Point import Point
from Pixel import Pixel
p1 = Point(5, 5) # Point at (5, 5)
p2 = Pixel("red", 10, 20) # red Pixel at (10, 20)
p2.move(30, 40) # move to (30, 40)
p3 = Pixel("green", 40, 60) # green Pixel at (40, 60)
p3.down() # move down
p3.right() # move right
print("There are %d Points" %Point.numPoints())
for p in [p1, p2, p3]:
print(p)
p3.clear() # clear Pixel
print(p3) # color should be cleared
#################################################
#
# $ pixels.py
# There are 3 Points
# (5, 5)
# color is red at (30, 40)
# color is green at (41, 59)
# color is at (0, 0)
#
示例3: Point
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import numPoints [as 别名]
#!/usr/bin/env python
# points.py - Point program
from Point import Point
p1 = Point(5, 5) # Point at (5, 5)
p1.down() # move down
p1.right() # move right
print "Point 1 at:", p1.getX(), p1.getY()
p2 = Point(10, 20) # Point at (10, 20)
p2.move(30, 40) # move to (30, 40)
print "Point 2 at:", p2.getX(), p2.getY()
print Point.numPoints(), "Points"
del p1, p2 # delete Point objects
print Point.numPoints(), "Points"
#################################################
#
# $ points.py
# Point 1 at: 6 4
# Point 2 at: 30 40
# 2 Points
# 0 Points
#