本文整理汇总了Python中sprites.Sprites.set_cairo_context方法的典型用法代码示例。如果您正苦于以下问题:Python Sprites.set_cairo_context方法的具体用法?Python Sprites.set_cairo_context怎么用?Python Sprites.set_cairo_context使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sprites.Sprites
的用法示例。
在下文中一共展示了Sprites.set_cairo_context方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SlideRule
# 需要导入模块: from sprites import Sprites [as 别名]
# 或者: from sprites.Sprites import set_cairo_context [as 别名]
#.........这里部分代码省略.........
def update_textview_y_offset(self, dy):
''' Need to account for menu height in GNOME '''
self.reticule.tabs[0].textview_y_offset += dy
self.reticule.tabs[1].textview_y_offset += dy
for slide in self.slides:
slide.tabs[0].textview_y_offset += dy
slide.tabs[1].textview_y_offset += dy
def _text_focus_out_cb(self, widget=None, event=None):
''' One of the four textviews was in focus '''
i = None
if widget in self.text_entries:
i = self.text_entries.index(widget)
bounds = self.text_buffers[i].get_bounds()
text = self.text_buffers[i].get_text(bounds[0], bounds[1], True)
text = text.strip()
self._process_numeric_input(i, text)
def _set_screen_dpi(self):
dpi = _get_screen_dpi()
font_map_default = PangoCairo.font_map_get_default()
font_map_default.set_resolution(dpi)
def __draw_cb(self, canvas, cr):
self.sprites.redraw_sprites(cr=cr)
# Handle the expose-event by drawing
def do_expose_event(self, event):
# Create the cairo context
cr = self.canvas.window.cairo_create()
print 'set cr in do_expose'
self.sprites.set_cairo_context(cr)
# Restrict Cairo to the exposed area; avoid extra work
cr.rectangle(event.area.x, event.area.y,
event.area.width, event.area.height)
cr.clip()
# Refresh sprite list
self.sprites.redraw_sprites(cr=cr)
def _destroy_cb(self, win, event):
Gtk.main_quit()
def _keypress_cb(self, area, event):
""" Keypress: moving the slides with the arrow keys """
k = Gdk.keyval_name(event.keyval)
if not self.sugar:
return
if k == 'a':
self.parent.show_a()
elif k == 'k':
self.parent.show_k()
elif k in ['c', 'asterisk', 'x']:
self.parent.show_c()
elif k in ['i', '/']:
self.parent.show_ci()
elif k == 's':
self.parent.show_s()
elif k == 't':
self.parent.show_t()
elif k in ['l', 'plus']:
self.parent.show_l()
elif k in ['Left', 'less']: