本文整理汇总了Python中ginga.gtkw.GtkHelp.pixbuf_new_from_data方法的典型用法代码示例。如果您正苦于以下问题:Python GtkHelp.pixbuf_new_from_data方法的具体用法?Python GtkHelp.pixbuf_new_from_data怎么用?Python GtkHelp.pixbuf_new_from_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ginga.gtkw.GtkHelp
的用法示例。
在下文中一共展示了GtkHelp.pixbuf_new_from_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_rgb_image_as_pixbuf
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import pixbuf_new_from_data [as 别名]
def get_rgb_image_as_pixbuf(self):
dawd = self.surface.get_width()
daht = self.surface.get_height()
rgb_buf = bytes(self.surface.get_data())
pixbuf = GtkHelp.pixbuf_new_from_data(rgb_buf, gtk.gdk.COLORSPACE_RGB,
False, 8, dawd, daht, dawd*3)
return pixbuf
示例2: get_plain_image_as_pixbuf
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import pixbuf_new_from_data [as 别名]
def get_plain_image_as_pixbuf(self):
#arr = self.getwin_array(order=self._rgb_order)
arr = self.getwin_array(order='RGB')
try:
pixbuf = GtkHelp.pixbuf_new_from_array(arr, gtk.gdk.COLORSPACE_RGB,
8)
except Exception as e:
self.logger.warning("Error making pixbuf: %s" % (str(e)))
# pygtk might have been compiled without numpy support
daht, dawd, depth = arr.shape
rgb_buf = self._get_rgbbuf(arr)
pixbuf = GtkHelp.pixbuf_new_from_data(rgb_buf,
gtk.gdk.COLORSPACE_RGB,
False, 8, dawd, daht, dawd*3)
return pixbuf