本文整理汇总了Python中block.Block.traverse方法的典型用法代码示例。如果您正苦于以下问题:Python Block.traverse方法的具体用法?Python Block.traverse怎么用?Python Block.traverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block.Block
的用法示例。
在下文中一共展示了Block.traverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Fraction
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import traverse [as 别名]
class Fraction(Top):
def __init__(self, over, under):
Top.__init__(self, find_bounding_box(over + under))
from block import Block
self.over = Block(over)
self.under = Block(under)
def draw(self, target, text=""):
if text:
text = text + "."
self.over.draw(target, text + "o")
self.under.draw(target, text + "u")
def resolve_fractions(self):
self.over.resolve_fractions()
self.under.resolve_fractions()
def resolve_exponents(self):
self.over.resolve_exponents()
self.under.resolve_exponents()
def resolve_indices(self):
self.over.resolve_indices()
self.under.resolve_indices()
def is_exponent(self, other):
return False, 0
def is_index(self, other):
return False, 0
def to_latex(self, image, classifier):
return "\\frac{" + self.over.to_latex(image, classifier) + "}{" + self.under.to_latex(image, classifier) + "}"
def traverse(self, function):
self.over.traverse(function)
self.under.traverse(function)