~ubuntu-branches/ubuntu/saucy/python-imaging/saucy-proposed

« back to all changes in this revision

Viewing changes to Scripts/player.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# $Id$
4
4
#
5
5
 
6
 
from Tkinter import *
 
6
from __future__ import print_function
 
7
 
 
8
try:
 
9
    from tkinter import *
 
10
except ImportError:
 
11
    from Tkinter import *
 
12
 
7
13
from PIL import Image, ImageTk
8
14
import sys
9
15
 
36
42
class UI(Label):
37
43
 
38
44
    def __init__(self, master, im):
39
 
        if type(im) == type([]):
 
45
        if isinstance(im, list):
40
46
            # list of images
41
47
            self.im = im[1:]
42
48
            im = self.im[0]
65
71
 
66
72
    def next(self):
67
73
 
68
 
        if type(self.im) == type([]):
 
74
        if isinstance(self.im, list):
69
75
 
70
76
            try:
71
77
                im = self.im[0]
98
104
if __name__ == "__main__":
99
105
 
100
106
    if not sys.argv[1:]:
101
 
        print "Syntax: python player.py imagefile(s)"
 
107
        print("Syntax: python player.py imagefile(s)")
102
108
        sys.exit(1)
103
109
 
104
110
    filename = sys.argv[1]
108
114
 
109
115
    if len(sys.argv) > 2:
110
116
        # list of images
111
 
        print "loading..."
 
117
        print("loading...")
112
118
        im = []
113
119
        for filename in sys.argv[1:]:
114
120
            im.append(Image.open(filename))