Hey, I am confused how to display an image in the same window.
This is my code for removing a certain color(removing green) from a picture, saving it and then it displays into a different window. I need it in same window and to be below the original image.
any ideas?

def RemoveGreen(img):
    newImg = EmptyImage(img.getWidth(),img.getHeight())
    
    for y in range(img.getHeight()):
        for x in range(img.getWidth()):
            p = img.getPixel(x,y)

            r = p.getRed()
            g = p.getGreen()
            b = p.getBlue()
            newPixel = Pixel(r,0,b)
            newImg.setPixel(x,y,newPixel)
    return newImg

img = FileImage("sonic!!.gif")
win = ImageWin("Original",img.getWidth(),img.getHeight())
img.draw( win )
img4 = RemoveGreen( img )
win4 = ImageWin("magenta with no green in it", img.getWidth(), img.getHeight())
img4.draw(win4)
win4.exitOnClick()

Use two labels with a image.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.