本文整理匯總了Python中pyglet.sprite.Sprite.bw方法的典型用法代碼示例。如果您正苦於以下問題:Python Sprite.bw方法的具體用法?Python Sprite.bw怎麽用?Python Sprite.bw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyglet.sprite.Sprite
的用法示例。
在下文中一共展示了Sprite.bw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addEntry
# 需要導入模塊: from pyglet.sprite import Sprite [as 別名]
# 或者: from pyglet.sprite.Sprite import bw [as 別名]
def addEntry(self, title="No title", action=None, top=False):
h = self.but_h
w = self.but_w
x = self.w.width / 2
y = (
self.w.height / 2 - (h * len(self.entries)) +
self.spacing
)
if title == "New Game":
btn_texture = self.w.textures["button_green_jagged"]
elif title == "Exit":
btn_texture = self.w.textures["button_red"]
else:
btn_texture = self.w.textures["button_brown"]
b_sprite = Sprite(
btn_texture,
x=x,
y=y,
batch=self.w.batches["mm_buttons"],
group=self.w.ui_group,
)
b_sprite.opacity = 150
# b_sprite.width, b_sprite.height = 3, 1
b_sprite.rectangle = create_rectangle(x, y, w, h)
b_sprite.action = action
b_sprite.label = text.Label(
title, font_name='Visitor TT1 BRK',
font_size=self.font_size,
color=self.font_clr,
x=x, y=y,
batch=self.w.batches["mm_labels"],
anchor_x="center", anchor_y="center"
)
b_sprite.label.oldfontsize = b_sprite.label.font_size
b_sprite.orig_size = self.but_w, self.but_h
b_sprite.bw, b_sprite.bh = b_sprite.orig_size
if top:
self.entries.insert(0, b_sprite)
self.updateOffset()
else:
self.entries.append(b_sprite)
self.updateOffset()