本文整理汇总了Python中kytten.widgets.Control.size方法的典型用法代码示例。如果您正苦于以下问题:Python Control.size方法的具体用法?Python Control.size怎么用?Python Control.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kytten.widgets.Control
的用法示例。
在下文中一共展示了Control.size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: size
# 需要导入模块: from kytten.widgets import Control [as 别名]
# 或者: from kytten.widgets.Control import size [as 别名]
def size(self, dialog, scale):
"""Constructs a vertex list to draw a crossed square.
@param dialog The Dialog within which we are contained
"""
if dialog is None:
return
Control.size(self, dialog, scale)
if self.vertex_list is None and not self.is_disabled():
self.color = dialog.theme['gui_color']
num_points, vertices = self._get_vertices()
self.vertex_list = dialog.batch.add(num_points, gl.GL_LINES,
dialog.fg_group,
('v2i', vertices),
('c4B', self.color * num_points))
示例2: size
# 需要导入模块: from kytten.widgets import Control [as 别名]
# 或者: from kytten.widgets.Control import size [as 别名]
def size(self, dialog):
Control.size(self, dialog)
self.width = 2 * (self.RADIUS + self.BORDER)
self.height = self.width
if self.circle_vlist is None:
self.circle_vlist = dialog.batch.add(
4 * self.NUM_SEGMENTS,
gl.GL_QUADS,
dialog.fg_group,
("v2f", self._get_circle_vlist_vertices()),
("c4B", [255, 255, 255, 255] * (4 * self.NUM_SEGMENTS)),
)
if self.inner_circle_vlist is None:
self.inner_circle_vlist = dialog.batch.add(
3 * self.NUM_SEGMENTS,
gl.GL_TRIANGLES,
dialog.fg_group,
("v2f", self._get_inner_circle_vlist_vertices()),
("c4B", self.color * (3 * self.NUM_SEGMENTS)),
)
if self.inner_circle_bg_vlist is None:
self.inner_circle_bg_vlist = dialog.batch.add(
3 * self.NUM_SEGMENTS,
gl.GL_TRIANGLES,
dialog.bg_group,
("v2f", self._get_inner_circle_vlist_vertices()),
("c4B", self._get_inner_circle_bg_vlist_colors()),
)
if self.colors_vlist is None:
self.colors_vlist = dialog.batch.add(
4 * self.NUM_SEGMENTS,
gl.GL_QUADS,
dialog.fg_group,
("v2f", self._get_colors_vlist_vertices()),
("c3B", self._get_colors_vlist_colors()),
)
if self.triangle_vlist is None:
self.triangle_vlist = dialog.batch.add(
6,
gl.GL_TRIANGLES,
dialog.highlight_group,
("v2f", self._get_triangle_vlist_vertices()),
("c3B", self._get_triangle_vlist_colors()),
)
if self.crosshair is None:
self.crosshair = dialog.theme[self.path]["image"].generate(
[255, 255, 255, 255], dialog.batch, dialog.highlight_group
)
示例3: size
# 需要导入模块: from kytten.widgets import Control [as 别名]
# 或者: from kytten.widgets.Control import size [as 别名]
def size(self, dialog):
Control.size(self, dialog)
self.width = self.texture.width * self.scale
self.height = self.texture.height * self.scale
if self.texture_vlist is None:
self.texture_group = pyglet.graphics.TextureGroup(
self.texture, dialog.fg_group)
self.texture_vlist = dialog.batch.add(4, gl.GL_QUADS,
self.texture_group,
('v2i', self._get_texture_vertices()),
('c4B', (255, 255, 255, 255) * 4),
('t3f', self.texture.tex_coords))
if self.resizer_vlist is None:
self.resizer_vlist = dialog.batch.add(40, gl.GL_LINES,
dialog.highlight_group,
('v2i', self._get_resizer_vertices()),
('c4B', self.color * 40))
if self.limits_vlist is None:
self.limits_vlist = dialog.batch.add(8, gl.GL_LINES,
dialog.highlight_group,
('v2i', self._get_limits_vertices()),
('c4B', (192, 192, 192, 255) * 8))
示例4: size
# 需要导入模块: from kytten.widgets import Control [as 别名]
# 或者: from kytten.widgets.Control import size [as 别名]
def size(self, dialog):
if dialog is None:
return
Control.size(self, dialog)
if self.is_selected:
path = ['menuoption', 'selection']
else:
path = ['menuoption']
if self.sprite is None:
if self.is_disabled():
opacity = 50
color = dialog.theme[path]['disabled_color']
else:
opacity = 255
color = dialog.theme[path]['text_color']
self.sprite = pyglet.sprite.Sprite(
self.image, batch=dialog.batch, group=dialog.fg_group)#, y=y, x=x, batch=self.tiles_batch)
self.sprite.opacity = opacity
if self.scale_size is not None:
self.sprite.scale = self.scale_size / float(self.sprite.width)
self.width = self.sprite.width + self.padding * 2
self.height = self.sprite.height + self.padding * 2
#~ if self.background is None:
#~ if self.is_selected:
#~ self.background = \
#~ dialog.theme[path]['highlight']['image'].generate(
#~ dialog.theme[path]['gui_color'],
#~ dialog.batch,
#~ dialog.bg_group)
if self.highlight is None:
if self.is_selected:
self.highlight = \
dialog.theme[path]['palette']['image'].generate(
dialog.theme[path]['input']['gui_color'],
dialog.batch,
dialog.highlight_group)