I am trying to work with cImage. But I cant get my second window to load up my img file. It always bring up a window with out the img. I have been playing with it for an hour and a half now and im thinking it has to be something stupid.

from cImage import *

import random
randCl = random.randint (1, 256)
randPixel = Pixel(randCl, randCl, randCl )
whitePixel = Pixel(255,255,55)
blackPixel = Pixel(0,0,0)

def DrawLinelite (img):
    img1 = EmptyImage (img.getWidth(), img.getHeight())
        for i in range (img.getWidth()):
        img1.setPixel(i,30,randPixel)

    return img1
   
    

img = FileImage( "blackbox.gif" )
win = ImageWin( "Original", img.getWidth(), img.getHeight() )
img.draw( win )

img1 = DrawLinelite ( img )
win1 = ImageWin ("DrawLinelite", img.getWidth(), img.getHeight ())
img1.draw( win1 )

win.exitOnClick()
win1.exitOnClick()

Missing indent of for at line 12 at least.

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.