本文整理汇总了Python中Graph.createPoint方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.createPoint方法的具体用法?Python Graph.createPoint怎么用?Python Graph.createPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.createPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawWithGraph
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import createPoint [as 别名]
def drawWithGraph(self, audioData):
# global p
graph = Graph(Point(75, 50), 50)
graph.draw(self.window)
# p = None
for d in audioData:
if self.p:
self.p.undraw()
bx, by = self.normalize(d[0], d[1], d[2])
# change the color if drawing the matching vowel point
# then save it and return p to None
if self.drawMatching:
self.m = graph.createPoint(bx, by)
self.m.setFill("green")
self.m.setOutline("green")
self.m.draw(self.window)
else:
self.p = graph.createPoint(bx, by)
self.p.draw(self.window)
示例2: drawWithGraph
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import createPoint [as 别名]
def drawWithGraph(window, audioData):
global p
graph = Graph( Point(75, 50), 50)
graph.draw(window)
#p = None
for d in audioData:
if p:
p.undraw()
bx, by = normalize(d[0], d[1], d[2])
p = graph.createPoint(bx, by)
p.draw(window)
示例3: __init__
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import createPoint [as 别名]
#.........这里部分代码省略.........
#t = createTriangle( Point(40, 10), 70, bx, by)
if (self.drawMatching) :
self.m = self.createTriangle( self.originViz, 70, bx, by)
self.m.draw(self.window)
else :
#self.t = self.createTriangle( self.originViz, 70, bx, by, delta)
newT = self.createTriangle( self.originViz, 70, bx, by, delta)
if (undrawt) :
self.t.undraw()
self.t = newT
self.t.draw(self.window)
#print("Triangle:", bx, by)
return bx, by
#time.sleep(1)
def drawWithGraph(self, audioData):
#undraw the previous graph if any
if self.graph :
self.graph.undrawAxis()
self.graph = Graph( Point(75, 50), 50)
self.graph.draw(self.window)
for d in audioData:
undrawp = False
if self.p:
#self.p.undraw()
undrawp = True
bx, by, delta = self.normalize(d[0], d[1], d[2])
# change the color if drawing the matching vowel point
# then save it and return p to None
if (self.drawMatching) :
self.m = self.graph.createPoint(bx, by)
self.m.setFill('blue')
self.m.setOutline('blue')
self.m.draw(self.window)
else :
#self.p = self.graph.createPoint(bx, by)
newp = self.graph.createPoint(bx, by)
if (undrawp) :
self.p.undraw()
self.p = newp
if (delta < (self.vTolerance*3)) :
self.p.setFill('green')
self.p.setOutline('green')
else :
self.p.setFill('red')
self.p.setOutline('red')
self.p.draw(self.window)
#time.sleep(1)
#print("Graph:", bx, by)
return bx, by
def createOval(self, center, size, bx, by, delta = 10):
divider1 = 4/size
divider2 = 8/size
p1 = Point(center.getX() - bx/divider2, center.getY() - by/divider1)
p2 = Point(center.getX() + bx/divider2, center.getY() + by/divider1)
vowel = Oval(p1, p2)
if (self.drawMatching) :
vowel.setFill('blue')
else :