本文整理匯總了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
#