Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
tkinter.PhotoImage Class Reference
Inheritance diagram for tkinter.PhotoImage:
Inheritance graph
[legend]
Collaboration diagram for tkinter.PhotoImage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def blank
def cget
def __getitem__
def copy
def zoom
def subsample
def get
def put
def write
def __str__
def __setitem__
def configure
def height
def type
def width

Public Attributes

 name
 tk

Static Public Attributes

 config = configure

Detailed Description

Widget which can display colored images in GIF, PPM/PGM format.

Definition at line 3221 of file __init__.py.


Constructor & Destructor Documentation

def tkinter.PhotoImage.__init__ (   self,
  name = None,
  cnf = {},
  master = None,
  kw 
)
Create an image with NAME.

Valid resource names: data, format, file, gamma, height, palette,
width.

Definition at line 3223 of file __init__.py.

03223 
03224     def __init__(self, name=None, cnf={}, master=None, **kw):
03225         """Create an image with NAME.
03226 
03227         Valid resource names: data, format, file, gamma, height, palette,
03228         width."""
        Image.__init__(self, 'photo', name, cnf, master, **kw)

Here is the caller graph for this function:


Member Function Documentation

def tkinter.PhotoImage.__getitem__ (   self,
  key 
)

Reimplemented from tkinter.Image.

Definition at line 3236 of file __init__.py.

03236 
03237     def __getitem__(self, key):
        return self.tk.call(self.name, 'cget', '-' + key)
def tkinter.Image.__setitem__ (   self,
  key,
  value 
) [inherited]

Definition at line 3194 of file __init__.py.

03194 
03195     def __setitem__(self, key, value):
        self.tk.call(self.name, 'configure', '-'+key, value)
def tkinter.Image.__str__ (   self) [inherited]

Definition at line 3186 of file __init__.py.

03186 
    def __str__(self): return self.name
def tkinter.PhotoImage.blank (   self)
Display a transparent image.

Definition at line 3229 of file __init__.py.

03229 
03230     def blank(self):
03231         """Display a transparent image."""
        self.tk.call(self.name, 'blank')
def tkinter.PhotoImage.cget (   self,
  option 
)
Return the value of OPTION.

Definition at line 3232 of file __init__.py.

03232 
03233     def cget(self, option):
03234         """Return the value of OPTION."""
        return self.tk.call(self.name, 'cget', '-' + option)

Here is the caller graph for this function:

def tkinter.Image.configure (   self,
  kw 
) [inherited]
Configure the image.

Definition at line 3198 of file __init__.py.

03198 
03199     def configure(self, **kw):
03200         """Configure the image."""
03201         res = ()
03202         for k, v in _cnfmerge(kw).items():
03203             if v is not None:
03204                 if k[-1] == '_': k = k[:-1]
03205                 if hasattr(v, '__call__'):
03206                     v = self._register(v)
03207                 res = res + ('-'+k, v)
        self.tk.call((self.name, 'config') + res)

Here is the call graph for this function:

def tkinter.PhotoImage.copy (   self)
Return a new PhotoImage with the same image as this widget.

Definition at line 3239 of file __init__.py.

03239 
03240     def copy(self):
03241         """Return a new PhotoImage with the same image as this widget."""
03242         destImage = PhotoImage()
03243         self.tk.call(destImage, 'copy', self.name)
        return destImage
def tkinter.PhotoImage.get (   self,
  x,
  y 
)
Return the color (red, green, blue) of the pixel at X,Y.

Definition at line 3258 of file __init__.py.

03258 
03259     def get(self, x, y):
03260         """Return the color (red, green, blue) of the pixel at X,Y."""
        return self.tk.call(self.name, 'get', x, y)

Here is the caller graph for this function:

def tkinter.Image.height (   self) [inherited]
Return the height of the image.

Definition at line 3209 of file __init__.py.

03209 
03210     def height(self):
03211         """Return the height of the image."""
03212         return getint(
            self.tk.call('image', 'height', self.name))
def tkinter.PhotoImage.put (   self,
  data,
  to = None 
)
Put row formatted colors to image starting from
position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))

Definition at line 3261 of file __init__.py.

03261 
03262     def put(self, data, to=None):
03263         """Put row formatted colors to image starting from
03264         position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))"""
03265         args = (self.name, 'put', data)
03266         if to:
03267             if to[0] == '-to':
03268                 to = to[1:]
03269             args = args + ('-to',) + tuple(to)
        self.tk.call(args)
def tkinter.PhotoImage.subsample (   self,
  x,
  y = '' 
)
Return a new PhotoImage based on the same image as this widget
but use only every Xth or Yth pixel.

Definition at line 3251 of file __init__.py.

03251 
03252     def subsample(self,x,y=''):
03253         """Return a new PhotoImage based on the same image as this widget
03254         but use only every Xth or Yth pixel."""
03255         destImage = PhotoImage()
03256         if y=='': y=x
03257         self.tk.call(destImage, 'copy', self.name, '-subsample',x,y)
        return destImage
def tkinter.Image.type (   self) [inherited]
Return the type of the imgage, e.g. "photo" or "bitmap".

Definition at line 3213 of file __init__.py.

03213 
03214     def type(self):
03215         """Return the type of the imgage, e.g. "photo" or "bitmap"."""
        return self.tk.call('image', 'type', self.name)

Here is the caller graph for this function:

def tkinter.Image.width (   self) [inherited]
Return the width of the image.

Definition at line 3216 of file __init__.py.

03216 
03217     def width(self):
03218         """Return the width of the image."""
03219         return getint(
03220             self.tk.call('image', 'width', self.name))

def tkinter.PhotoImage.write (   self,
  filename,
  format = None,
  from_coords = None 
)
Write image to file FILENAME in FORMAT starting from
position FROM_COORDS.

Definition at line 3271 of file __init__.py.

03271 
03272     def write(self, filename, format=None, from_coords=None):
03273         """Write image to file FILENAME in FORMAT starting from
03274         position FROM_COORDS."""
03275         args = (self.name, 'write', filename)
03276         if format:
03277             args = args + ('-format', format)
03278         if from_coords:
03279             args = args + ('-from',) + tuple(from_coords)
03280         self.tk.call(args)

def tkinter.PhotoImage.zoom (   self,
  x,
  y = '' 
)
Return a new PhotoImage with the same image as this widget
but zoom it with X and Y.

Definition at line 3244 of file __init__.py.

03244 
03245     def zoom(self,x,y=''):
03246         """Return a new PhotoImage with the same image as this widget
03247         but zoom it with X and Y."""
03248         destImage = PhotoImage()
03249         if y=='': y=x
03250         self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)
        return destImage

Member Data Documentation

tkinter.Image.config = configure [static, inherited]

Definition at line 3208 of file __init__.py.

tkinter.Image.name [inherited]

Definition at line 3165 of file __init__.py.

tkinter.Image.tk [inherited]

Definition at line 3170 of file __init__.py.


The documentation for this class was generated from the following file: