Package param :: Module tk :: Class Button
[hide private]
[frames] | no frames]

Class Button

source code


A GUI-specific parameter to display a button.

Can be associated with an image by specifying an image_path (i.e. location of an image suitable for PIL, e.g. a PNG, TIFF, or JPEG image) and optionally a size (width,height) tuple.

Note that the button size can also be set when there is no image, but instead of being presumed to be in pixels, it is presumed to be in text units (a Tkinter feature: see e.g. http://effbot.org/tkinterbook/button.htm). Therefore, to place two identically sized buttons next to each other, with one displaying text and the other an image, you first have to convert one of the sizes to the other's units.

Nested Classes [hide private]

Inherited from parameterized.Parameter: __metaclass__

Instance Methods [hide private]
 
__init__(self, default=None, image_path=None, size=None, **params)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
get_image(self)
Return an ImageTk.PhotoImage of the image at image_path (or None if image_path is None or an Image cannot be created).
source code

Inherited from Callable: __set__

Inherited from parameterized.Parameter: __delete__, __get__, __getstate__, __setstate__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __classdoc = '\n A GUI-specific parameter to display a butt...
str(object) -> string
Properties [hide private]
  _hack
  image_path
  size

Inherited from parameterized.Parameter: constant, default, doc, instantiate, pickle_default_value, precedence, readonly

Inherited from object: __class__

Method Details [hide private]

__init__(self, default=None, image_path=None, size=None, **params)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

Class Variable Details [hide private]

__classdoc

str(object) -> string

Return a nice string representation of the object. If the argument is a string, the return value is the same object.

Value:
'''
    A GUI-specific parameter to display a button.

    Can be associated with an image by specifying an image_path
    (i.e. location of an image suitable for PIL, e.g. a PNG, TIFF, or
    JPEG image) and optionally a size (width,height) tuple.

    Note that the button size can also be set when there is no image,
...