Back to index

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

List of all members.

Public Member Functions

def __init__
def __str__
def __del__
def __setitem__
def __getitem__
def configure
def height
def type
def width

Public Attributes

 name
 tk

Static Public Attributes

 config = configure

Static Private Attributes

int _last_id = 0

Detailed Description

Base class for images.

Definition at line 3161 of file __init__.py.


Constructor & Destructor Documentation

def tkinter.Image.__init__ (   self,
  imgtype,
  name = None,
  cnf = {},
  master = None,
  kw 
)

Definition at line 3164 of file __init__.py.

03164 
03165     def __init__(self, imgtype, name=None, cnf={}, master=None, **kw):
03166         self.name = None
03167         if not master:
03168             master = _default_root
03169             if not master:
03170                 raise RuntimeError('Too early to create image')
03171         self.tk = master.tk
03172         if not name:
03173             Image._last_id += 1
03174             name = "pyimage%r" % (Image._last_id,) # tk itself would use image<x>
03175             # The following is needed for systems where id(x)
03176             # can return a negative number, such as Linux/m68k:
03177             if name[0] == '-': name = '_' + name[1:]
03178         if kw and cnf: cnf = _cnfmerge((cnf, kw))
03179         elif kw: cnf = kw
03180         options = ()
03181         for k, v in cnf.items():
03182             if hasattr(v, '__call__'):
03183                 v = self._register(v)
03184             options = options + ('-'+k, v)
03185         self.tk.call(('image', 'create', imgtype, name,) + options)
        self.name = name

Here is the caller graph for this function:

def tkinter.Image.__del__ (   self)

Definition at line 3187 of file __init__.py.

03187 
03188     def __del__(self):
03189         if self.name:
03190             try:
03191                 self.tk.call('image', 'delete', self.name)
03192             except TclError:
03193                 # May happen if the root was destroyed
                pass

Member Function Documentation

def tkinter.Image.__getitem__ (   self,
  key 
)

Reimplemented in tkinter.PhotoImage.

Definition at line 3196 of file __init__.py.

03196 
03197     def __getitem__(self, key):
        return self.tk.call(self.name, 'configure', '-'+key)
def tkinter.Image.__setitem__ (   self,
  key,
  value 
)

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)

Definition at line 3186 of file __init__.py.

03186 
    def __str__(self): return self.name
def tkinter.Image.configure (   self,
  kw 
)
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.Image.height (   self)
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.Image.type (   self)
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)
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))


Member Data Documentation

int tkinter.Image._last_id = 0 [static, private]

Definition at line 3163 of file __init__.py.

Definition at line 3208 of file __init__.py.

Definition at line 3165 of file __init__.py.

Definition at line 3170 of file __init__.py.


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