PyGtk gi显示通过cv2在图像小部件中显示图像

2024-05-19 07:22:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用这段代码在PyGtk图像小部件中显示图像。但它显示的是空行

img_gtk = Gtk.Image()
# Do other things such as attaching the 'img_gtk' to a window/grid...

# Convert and display:
h, w, d = img.shape
pixbuf = GdkPixbuf.Pixbuf.new_from_data  (img.tostring(), GdkPixbuf.Colorspace.RGB, False, 8, w, h, w*3, None, None)
img_gtk.set_from_pixbuf (pixbuf)

如何使用pixbuf进行此操作


Tags: 代码from图像imagenonegtkimg部件

热门问题