本文整理匯總了Python中Vector.length方法的典型用法代碼示例。如果您正苦於以下問題:Python Vector.length方法的具體用法?Python Vector.length怎麽用?Python Vector.length使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Vector
的用法示例。
在下文中一共展示了Vector.length方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Vector
# 需要導入模塊: import Vector [as 別名]
# 或者: from Vector import length [as 別名]
from Arena import Arena # Import our Arena
from Turtle import Turtle # Import our Turtle
from Vector import * # Import everything from our Vector
from WalkingTurtle import *
from Statue import Statue
from Mouse import Mouse
import Cat
meter = 20 # How many pixels is one meter?
statue_radius = 1# What is the statue's radius
cat_radius = 1.5
cat_angle = 0
mouse_angle = 45
x = Vector()
print x.length()
tk = Tk() # Create a Tk top-level widget
arena = Arena(tk) # Create an Arena widget, arena
arena.pack() # Tell arena to pack itself on screen
s = Statue(Vector(200,200),statue_radius,meter)
arena.add(s)
m = Mouse(s,mouse_angle)
c = Cat.Cat(cat_angle,cat_radius,m)
arena.add(c)
arena.add(m)
arena.cat_rad.set('CatRadius: '+str(cat_radius))
arena.cat_rad_label = Label(arena,textvariable=arena.cat_rad)
arena.cat_rad_label.pack()
arena.cat_ang.set('CatAngle: '+str(cat_angle))
arena.cat_ang_label = Label(arena,textvariable=arena.cat_ang)