when i try to scail picture down (( i did not have any problem )) using :
def generalscailing (picture ,pict , n ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture( picture )
canvas=makePicture( pict )
SourceX=0
width = getWidth(pic)
for TargetX in range(0,0+((width -0)/n)):
SourceY=0
for TargetY in range(0,0+((width -0)/n)):
px = getPixel ( pic , SourceX , SourceY)
tx = getPixel (canvas ,TargetX, TargetY )
setColor(tx,getColor(px))
SourceY = SourceY+ n
SourceX = SourceX + n
show (pic)
show (canvas)


but when i try to scail the picture up it does not work , whyyyyy ?????!!!

def generalscailing (picture ,pict , n ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture( picture )
canvas=makePicture( pict )
SourceX=0
width = getWidth(pic)
for TargetX in range(0,0+((width -0)*n)):
SourceY=0
for TargetY in range(0,0+((width -0)*n)):
px = getPixel ( pic , SourceX , SourceY)
tx = getPixel (canvas ,TargetX, TargetY )
setColor(tx,getColor(px))
SourceY = SourceY+ 1/n
SourceX = SourceX + 1/n
show (pic)
show (canvas)

if you are using Python2, you should use floating point in division:

+1./n

(do not use formated text in code block!)

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.