本文整理汇总了Python中pymt.graphx.set_color函数的典型用法代码示例。如果您正苦于以下问题:Python set_color函数的具体用法?Python set_color怎么用?Python set_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'])
开发者ID:Markitox,项目名称:pymt,代码行数:26,代码来源:slider.py
示例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()
开发者ID:Markitox,项目名称:pymt,代码行数:29,代码来源:vkeyboard.py
示例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)
开发者ID:Markitox,项目名称:pymt,代码行数:7,代码来源:modalwindow.py
示例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]
开发者ID:estemenson,项目名称:CMAP,代码行数:27,代码来源:scrible.py
示例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()
开发者ID:Markitox,项目名称:pymt,代码行数:7,代码来源:video.py
示例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)
开发者ID:triselectif,项目名称:pymt,代码行数:7,代码来源:video_gstreamer.py
示例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)
开发者ID:OpenWerkplek,项目名称:pymt,代码行数:8,代码来源:keybinding.py
示例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))
开发者ID:OpenWerkplek,项目名称:pymt,代码行数:8,代码来源:textarea.py
示例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))
开发者ID:Markitox,项目名称:pymt,代码行数:8,代码来源:__init__.py
示例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)
开发者ID:Markitox,项目名称:pymt,代码行数:8,代码来源:modalpopup.py
示例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()
开发者ID:Markitox,项目名称:pymt,代码行数:9,代码来源:colorpick.py
示例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()
开发者ID:bernt,项目名称:pymt,代码行数:10,代码来源:filebrowser.py
示例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)
开发者ID:Markitox,项目名称:pymt,代码行数:13,代码来源:buttonmatrix.py
示例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
开发者ID:estemenson,项目名称:pymt,代码行数:14,代码来源:textinput.py
示例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])
开发者ID:Markitox,项目名称:pymt,代码行数:18,代码来源:radial.py
示例16: draw
def draw(self):
super(MTCircularSlider, self).draw()
# faster calculation if we remove dot
x, y = self.center
p = 0, 0
r = self.radius
t = self.thickness
s = self.sweep_angle
padding = self.padding
with gx_matrix:
set_color(*self.style.get('bg-color'))
glTranslatef(x, y, 0)
glRotatef(-self.rotation, 0, 0, 1)
drawSemiCircle(p, r - t, r, 32, 1, 0, s)
set_color(*self.style.get('slider-color'))
drawSemiCircle(p, r - t + padding, r - padding,
32, 1, 0, self._slider_angle)
开发者ID:Markitox,项目名称:pymt,代码行数:19,代码来源:circularslider.py
示例17: draw
def draw(self):
if not self.visible:
return
for objectID in self.objects:
x, y, angle = self.objects[objectID]
with gx_matrix:
glTranslatef(x, y, 0.0)
glRotatef(angle, 0.0, 0.0, 1.0)
set_color(.5)
drawCSSRectangle(
pos=(-0.5 * self.width, -0.5 * self.height),
size=(self.width, self.height),
style=self.style
)
set_color(*self.style['vector-color'])
with gx_begin(GL_LINES):
glVertex2f(0., 0.)
glVertex2f(0., -0.5 * self.height)
开发者ID:Markitox,项目名称:pymt,代码行数:21,代码来源:objectdisplay.py
示例18: draw
def draw(self):
# select color from number of touch
if len(self._touches) == 0:
set_color(*self.style.get('bg-color'))
elif len(self._touches) == 1:
set_color(*self.style.get('bg-color-move'))
else:
set_color(*self.style.get('bg-color-full'))
# draw border
scaled_border = self.get_scaled_border()
self.update_controls()
drawRoundedRectangle(
pos=(-scaled_border, -scaled_border),
size=(self.width+scaled_border*2, self.height+scaled_border*2),
radius=15. / self.scale
)
# draw control background
control_width = self.btn_fullscreen.width + self.btn_close.width
drawRoundedRectangle(
pos=((self.width/2)-(scaled_border + control_width / 2), -scaled_border * 2),
size=(scaled_border*2 + control_width, scaled_border),
radius=15. / self.scale,
corners=(True, True, False, False)
)
开发者ID:Markitox,项目名称:pymt,代码行数:26,代码来源:innerwindow.py
示例19: draw_selection
def draw_selection(self, label, line_num):
'''Draw the current selection on the widget.
'''
a, b = self._selection_from, self._selection_to
if a > b:
a, b = b, a
s1c, s1r = self.get_cursor_from_index(a)
s2c, s2r = self.get_cursor_from_index(b)
if line_num < s1r or line_num > s2r:
return
x1 = label.x
x2 = label.x + label.width
y1 = label.y - self.line_height
g = self.glyph_size
if line_num == s1r:
lines = self.lines[line_num]
x1 += sum([g(x) for x in lines[:s1c]])
if line_num == s2r:
lines = self.lines[line_num]
x2 = label.x + sum([g(x) for x in lines[:s2c]])
set_color(*self.style.get('selection-color'))
drawRectangle(pos=(x1, y1), size=(x2-x1, self.line_height))
开发者ID:OpenWerkplek,项目名称:pymt,代码行数:22,代码来源:textarea.py
示例20: on_draw
def on_draw(self):
# background
set_color(*self.style['bg-color'])
drawRectangle(pos=self.pos, size=self.size)
if not len(self.children):
return
# draw left side
for i in xrange(0, self._selection):
self._render_cover(i)
# draw right side in reverse order
for i in xrange(len(self.children) - 1, self._selection, - 1):
self._render_cover(i)
# draw cover
self._render_cover(self._selection)
# draw title ?
if self.title_draw:
child = self.children[self._selection]
self._draw_title(child)
开发者ID:OpenWerkplek,项目名称:pymt,代码行数:23,代码来源:coverflow.py
注:本文中的pymt.graphx.set_color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论