Beispiel #1
0
def ImageUD(deepColor, shallowColor, borderColor, imageSize):
    image = PhotoImage()
    for x in xrange(imageSize):
        for y in xrange(imageSize):
            if x < 2 or x > imageSize - 3:
                Im.setRGB(image, x, y, borderColor)
            else:
                Im.setRGB(image, x, y, deepColor)
    return image
Beispiel #2
0
def run():
    # create the root and the canvas
    root = Tk()
    root.resizable(width=FALSE, height=FALSE)
    canvas = Canvas(root, width=800, height=600)
    canvas.pack(fill=BOTH, expand=YES)
    # Store canvas in root and in canvas itself for callbacks
    root.canvas = canvas.canvas = canvas

    # Set up canvas data and call init
    class Struct():
        pass

    canvas.data = Struct()
    print Im.getRGB(canvas, 100, 100)
    init(canvas)
    # set up events
    # root.bind("<Button-1>", leftMousePressed)
    # root.bind("<KeyPress>", keyPressed)
    # timerFired(canvas)
    # and launch the app
    root.mainloop(
    )  # This call BLOCKS (so your program waits until you close the window!)
Beispiel #3
0
def ImageU(deepColor, shallowColor, borderColor, imageSize):
    image = PhotoImage()
    for x in xrange(imageSize):
        for y in xrange(imageSize):
            if y < x - 1 and y < imageSize - 2 - x:
                Im.setRGB(image, x, y, deepColor)
            elif y < x + 1 and y < imageSize - x:
                Im.setRGB(image, x, y, borderColor)
            else:
                Im.setRGB(image, x, y, shallowColor)
    return image
Beispiel #4
0
def Image(deepColor, shallowColor, borderColor, imageSize):
    image = PhotoImage()
    b = imageSize / 2  #the border zone
    for x in xrange(imageSize):
        for y in xrange(imageSize):
            #outside
            if y > b - x + 2 and y < 3 * b - x - 1 and y > x - b and y < x + b - 3:
                Im.setRGB(image, x, y, deepColor)
            elif y > b - x - 1 and y < 3 * b - x + 1 and y > x - b - 2 and y < x + b:
                Im.setRGB(image, x, y, borderColor)
            else:
                Im.setRGB(image, x, y, shallowColor)
    return image
Beispiel #5
0
def ImageL(deepColor, shallowColor, borderColor, imageSize):
    return Im.lRotate(ImageU(deepColor, shallowColor, borderColor, imageSize))
Beispiel #6
0
def ImageD(deepColor, shallowColor, borderColor, imageSize):
    return Im.rotate180(ImageU(deepColor, shallowColor, borderColor,
                               imageSize))
Beispiel #7
0
def ImageRD(deepColor, shallowColor, borderColor, imageSize):
    return Im.rRotate(ImageUR(deepColor, shallowColor, borderColor, imageSize))
Beispiel #8
0
def ImageURDL(deepColor, shallowColor, borderColor, imageSize):
    image = PhotoImage()
    for x in xrange(imageSize):
        for y in xrange(imageSize):
            Im.setRGB(image, x, y, deepColor)
    return image