I found a one line solution data = "">cache , 'RGB') does the job2018-03-11 7:09 GMT+01:00 Peter Irbizon <peterirbizon@xxxxxxxxx>:Hi there,I have Code1 and at the end I want co continue with Code2 (both codes are included here). In Code2 I am doing data conversion with get_pixels(). I am trying take last_frame or frame_cache data in pygame code1 and then I want to do get_pixels() on it to get the same data format as in Code2 - or to use any function in pygame to get the same dataformat as from gtk get_pixels().Any idea please how to do it in my Code1 with pygame or how to combine both codes and use gtk get_pixels() function for conversion?Code 1:#we will process only one frame at the timemsgs = self.cap.read()msgl = len(msgs)if msgl:msg = msgs[msgl - 1]cmd = msg[0]if cmd == "data":data = "">last_frame = pygame.image.load(data)self.frame_update = Truefor msg in self.adb.read():cmd = msg[0]if cmd == "end":self.exit()self.menu_loop()if self.frame_update:self.frame_update = Falseif last_frame is not None:if self.landscape:a = last_frame.subsurface(pygame.Rect((0,0), self.sizel)) else:a = last_frame.subsurface(pygame.Rect((0,0), self.sizep)) aw, ah = a.get_size()if aw != self.proj[2] or ah != self.proj[3]:frame_cache = pygame.transform.smoothscale(a, (self.proj[2], self.proj[3])) else:frame_cache = a.copy()self.screen_update = Trueif self.screen_update:self.screen.fill((0, 0, 0))self.screen_update = Falseself.screen.blit(frame_cache, (self.proj[0], self.proj[1]))if self.show_menu:self.screen.blit(self.img_menu, (0, 0)) if self.show_nav:self.screen.blit(self.img_nav, (self.size[0] - self.nav_w, 0))pygame.display.update() #here i need to change it for gtk get_pixelsCode 2:img_width = 160img_height = 120data = "">gtk.gdk.COLORSPACE_RGB,False,8,img_width,img_height)data.get_from_drawable(gtk.gdk.get_default_root_window(), gtk.gdk.colormap_get_system(),280, 228, 0, 0,img_width,img_height)data = "" height, gtk.gdk.INTERP_NEAREST)data = "">
- References:
- [pygame] convert pygame image load surface to gtk get_pixels
- From: Peter Irbizon
- Re: [pygame] convert pygame image load surface to gtk get_pixels
- From: Peter Irbizon
- Prev by Author: Re: [pygame] convert pygame image load surface to gtk get_pixels
- Next by Author: Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math
- Previous by thread: Re: [pygame] convert pygame image load surface to gtk get_pixels
- Next by thread: [pygame] pygame sound generation examples
- Index(es):