Welcome, guest | Sign In | My Account | Store | Cart

(T)iled (V)ideo player was written to show some images that can be taken with Casio Exilim digital cameras. Now that big, 25 scene picture can actually make sense.

Python, 45 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import Tkinter
import tkFileDialog

def main():
    global X, Y
    X, Y = 0, 0
    root = Tkinter.Tk()
    root.withdraw()
    root.resizable(False, False)
    root.title('Tiled Video Player')
    image = get_image()
    screen = Tkinter.Canvas(root, width=320, height=240, background='red', highlightthickness=0)
    screen.pack()
    screen.create_image(800, 600, image=image)
    screen.after(100, update, screen)
    root.deiconify()
    root.mainloop()

def get_image():
    try:
        filename = tkFileDialog.askopenfilename(title='Tiled Video Player', filetypes=['{Tiled Video} .gif'])
        assert filename
        image = Tkinter.PhotoImage(file=filename)
        assert (1600, 1200) == (image.width(), image.height())
        return image
    except:
        raise SystemExit

def update(screen):
    global X, Y
    screen.after(100, update, screen)
    X += 1
    if X == 5:
        X = 0
        Y += 1
        if Y == 5:
            Y = 0
            screen.move(1, 1280, 960)
        else:
            screen.move(1, 1280, -240)
    else:
        screen.move(1, -320, 0)

if __name__ == '__main__':
    main()

This works very well if you have the right images.