當前位置: 首頁>>代碼示例>>Python>>正文


Python Point.numPoints方法代碼示例

本文整理匯總了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
#
開發者ID:tamle022276,項目名稱:python,代碼行數:27,代碼來源:points.py

示例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)
#
開發者ID:tamle022276,項目名稱:python,代碼行數:32,代碼來源:pixels.py

示例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
#
開發者ID:tamle022276,項目名稱:python,代碼行數:27,代碼來源:points.py


注:本文中的Point.Point.numPoints方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。