本文整理汇总了Python中block.Block.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Block.draw方法的具体用法?Python Block.draw怎么用?Python Block.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block.Block
的用法示例。
在下文中一共展示了Block.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import draw [as 别名]
class Game:
def __init__( self, scr, loop ):
self.scr = scr
from block import Block
self.block = Block( scr )
from message import Messages
self.msg = Messages( self.scr )
self.loop = loop
self.FPS = 60
self.block( self, self.loop )
def update( self ):
lasttime = time.time( )
self.block.update( )
self.FPS = 1.0 / ( time.time( ) - lasttime )
def draw( self ):
scr = self.scr
scr.fill( ( 35, 35, 35 ) )
self.block.draw( )
self.msg.message( round( self.FPS, 1 ), ( 10, 10 ) )
示例2: Fraction
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import draw [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)