本文整理汇总了Python中pymt.graphx.set_color函数的典型用法代码示例。如果您正苦于以下问题:Python set_color函数的具体用法?Python set_color怎么用?Python set_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw
def draw(self):
px, py = self.style['padding']
px2, py2 = px / 2, py / 2
if self.orientation == 'vertical':
pos = (self.x + px2, self.y + self.value_min * self.ratio + py2)
size = (self.width - px, (self.value_max - self.value_min) *
self.ratio - py)
textposmin = (self.x + self.width, self.y + self.value_min * self.ratio)
textposmax = (self.x + self.width, self.y + self.value_max * self.ratio)
elif self.orientation == 'horizontal':
pos = (self.x + self.value_min * self.ratio + px2, self.y + py2)
size = ((self.value_max - self.value_min) * self.ratio - px,
self.height - py)
textposmin = (self.x + self.value_min * self.ratio, self.y + self.height)
textposmax = (self.x + self.value_max * self.ratio, self.y + self.height)
# draw outer rectangle
set_color(*self.style.get('bg-color'))
drawCSSRectangle(pos=self.pos, size=self.size, style=self.style)
# draw inner rectangle
set_color(*self.style.get('slider-color'))
drawCSSRectangle(pos=pos, size=size, style=self.style, prefix='slider')
if self.showtext and len(self.touchstarts):
drawLabel(u'%.1f' % (self.value_min), pos=textposmin, font_size=self.style['font-size'])
drawLabel(u'%.1f' % (self.value_max), pos=textposmax, font_size=self.style['font-size'])
示例2: draw
def draw(self):
# background
set_color(*self.style['bg-color'])
drawCSSRectangle(size=self.size, style=self.style)
# content dynamic update
with gx_matrix:
glTranslatef(self.style['margin'][3], self.style['margin'][2], 0)
# draw precalculated background
self._current_cache['background'].draw()
# draw active keys layer
# +2 and -4 result of hard margin coded in _do_update (m = 3 * s)
# we substract 1 cause of border (draw-border is activated.)
set_color(*self.style['color-down'])
for key, size in self._active_keys:
x, y, w, h = size
drawCSSRectangle(pos=(x+2, y+2), size=(w-4, h-4),
style=self.style, prefix='key', state='down')
# search the good scale for current precalculated keys layer
if self._last_update_scale == self.scale:
s = 1. / self.scale# / self._last_update_scale
glScalef(s, s, s)
else:
s = 1. / self._last_update_scale
glScalef(s, s, s)
self._current_cache['keys'].draw()
示例3: draw
def draw(self):
w = self.get_parent_window()
if not w:
return
self.size = w.size
set_color(*self.style['bg-color'])
drawCSSRectangle(size=self.size, style=self.style)
示例4: draw
def draw(self):
super(MyScribbleWidget,self).draw()
# set_color(1, 1, 1)
d_txt = self.potential_deleted_text
if d_txt:
x = int(time.time()) % 2
if x == 0:
b_col = d_txt.style['bg-color']
d_txt.style['bg-color'] = d_txt.style['border-color']
d_txt.style['border-color'] = b_col
_del_list = []
for k in self.touch_positions.keys():
_points = self.touch_positions[k]['Cdata']
if not len(_points):
_del_list.append(k)
continue
_colour = self.touch_positions[k]['Color']
if self.potential_deleted_lines == k:
x = int(time.time()) % 2
if x == 0:
_colour = DELETED_LINE
else:
self.touch_positions[k]['Color'] = RED
set_color(*_colour)
drawLine(_points)
for k in _del_list:
del self.touch_positions[k]
示例5: draw
def draw(self):
b = self.bordersize
b2 = b * 2
set_color(*self.style['bg-color'])
drawCSSRectangle((-b, -b), (self.width + b2, self.height + b2),
style=self.style)
super(MTVideo, self).draw()
示例6: draw
def draw(self):
if self._texture:
set_color(*self.color)
drawTexturedRectangle(texture=self._texture, pos=self.pos, size=self.size)
else:
set_color(0, 0, 0)
drawRectangle(pos=self.pos, size=self.size)
示例7: draw
def draw(self):
if self.selected:
set_color(1,0,0,0.3)
drawRectangle(self.to_widget(*self.widget.pos), self.widget.size)
set_color(1,.3,0)
for c in self.child_layout.children:
drawLine((self.node_btn.centerright,c.node_btn.centerleft), width=2)
示例8: draw_cursor
def draw_cursor(self, x, y):
'''Draw the cursor on the widget
'''
if not int(self.cursor_fade):
return
set_color(*self.style.get('cursor-color'))
drawRectangle(size=(2, -self.line_height),
pos=(x + self.cursor_offset() - self._scroll_x, y))
示例9: draw
def draw(self):
'''Draw the current image camera'''
if self._texture:
set_color(*self.color)
drawTexturedRectangle(self._texture, pos=self.pos, size=self.size)
else:
drawRectangle(pos=self.pos, size=self.size)
drawLabel('No Camera :(', pos=(self.width/2, self.height/2))
示例10: on_popup_draw
def on_popup_draw(self):
self._xml.root.center = self.get_parent_window().center
popup = self._xml.getById('popup')
set_color(*self.style.get('bg-color-full'))
drawCSSRectangle(
pos=Vector(popup.pos) - (10, 10),
size=Vector(popup.size) + (20, 20),
style=self.style)
示例11: draw
def draw(self):
if not self.dl.is_compiled():
with self.dl:
set_color(*self.style['bg-color'])
drawCSSRectangle(size=self.size, style=self.style)
set_color(*self.current_color)
drawRectangle(pos=(10, 220), size=(110, 60))
self.dl.draw()
示例12: draw
def draw(self):
if self.selected:
selected_color = self.style.get('selected-color', (0.4,) * 4)
set_color(*selected_color)
drawCSSRectangle(pos=self.pos, size=self.size, style=self.style)
pos = int(self.x + self.width / 2.), int(self.y + 10)
drawLabel(label=self.striptext(self.label_txt, 10), pos=pos)
self.image.x = self.x + int(self.image.width / 2) - 5
self.image.y = self.y + int(self.image.height / 2) - 5
self.image.draw()
示例13: draw_tile
def draw_tile(self, i, j):
if self.matrix[i][j] == 0:
set_color(*self.buttoncolor)
if self.matrix[i][j]:
set_color(*self.downcolor)
with gx_matrix:
glTranslatef(self.width / self._matrix_size[0] * i + self.x,
self.height / self._matrix_size[1] * j + self.y,
0)
s = (self.width / self._matrix_size[0] - self.border,
self.height / self._matrix_size[1] - self.border)
drawRectangle(size=s)
示例14: draw
def draw(self):
if self._is_active_input and self.keyboard_type == 'virtual':
set_color(*self.style.get('bg-color'))
kx, ky = self.keyboard.to_window(*self.keyboard.center)
kx, ky = self.to_widget(kx, ky)
drawLine([self.center[0], self.center[1], kx, ky])
if self.password:
pw = '*' * len(self.label)
old_label = self.label
self.label = pw
super(MTTextInput, self).draw()
if self.password:
self.label = old_label
示例15: draw
def draw(self):
# Background
set_color(*self.style.get('bg-color'))
drawCircle(self.pos, self.radius)
# A good size for the hand, proportional to the size of the widget
hd = self.radius / 10
# Draw center of the hand
set_color(*self.style.get('vector-color'))
drawCircle(self.pos, hd)
# Rotate the triangle so its not skewed
l = prot((self.pos[0] - hd, self.pos[1]), self.angle-90, self.pos)
h = prot((self.pos[0] + hd, self.pos[1]), self.angle-90, self.pos)
# Draw triable of the hand
with gx_begin(GL_POLYGON):
glVertex2f(*l)
glVertex2f(*h)
glVertex2f(self.vector[0], self.vector[1])