Jump to content

BlkPxl

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by BlkPxl


  1. On 2/18/2022 at 7:28 PM, shineworld said:

    Initially failed to understand how in Demo29 the use of PIL allowed to place an image in a TImage object.
    But slowly I succeeded:

    
            rgb_im = PIL_Image.fromarray(np.uint8(frame)).convert('RGB')
            self.imgFrameI.Picture.Bitmap.SetSize(rgb_im.width, rgb_im.height)
            dib = PIL_ImageWin.Dib(rgb_im)
            dib.expose(self.imgFrameI.Picture.Bitmap.Canvas.Handle)
            self.imgFrameI.Repaint()
    
            rgb_im = PIL_Image.fromarray(np.uint8(frame_out)).convert('RGB')
            self.imgFrameO.Picture.Bitmap.SetSize(rgb_im.width, rgb_im.height)
            dib = PIL_ImageWin.Dib(rgb_im)
            dib.expose(self.imgFrameO.Picture.Bitmap.Canvas.Handle)
            self.imgFrameO.Repaint()

    Now perfectly works and from 30FPS of PySimpleGUI version, I've reached 89 stable FPS with delphivcl version.
    AMAZING how fast delphi vcl is"

     

    Hello. I'm trying to replicate this code but I'm running into a problem. The line "dib.expose(self.Image1.Picture.Bitmap.Canvas.Handle)" gives the error "line 101, in expose result = self.image.expose(handle)
    TypeError: argument 1 must be int, not None". I tried to get the handle via "PIL.ImageWin.HDC(self.Image1.Picture.Bitmap.Canvas)", but also to no avail. The error in this case is "TypeError: argument 1 must be int, not HDC" . Yes, and sorry for my English.

×