Package topo :: Package tkgui :: Module tkparameterizedobject :: Class ButtonParameter
[hide private]
[frames] | no frames]

Class ButtonParameter

source code

                         object --+        
                                  |        
 base.parameterizedobject.Parameter --+    
                                      |    
base.parameterclasses.CallableParameter --+
                                          |
                                         ButtonParameter

Parameter representing all Parameter classes that are GUI-specific.

Can be associated with an image when used in a TkParameterizedObject 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 instead 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 base.parameterizedobject.Parameter: __metaclass__

Instance Methods [hide private]
 
__init__(self, default=None, image_path=None, size=None, **params)
Initialize a new Parameter object: store the supplied attributes.
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 base.parameterclasses.CallableParameter: __set__

Inherited from base.parameterizedobject.Parameter: __delete__, __get__, __getstate__, __setstate__

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

Class Variables [hide private]
  __classdoc = '\n Parameter representing all Parameter class...
str(object) -> string
Properties [hide private]
  _hack
  image_path
  size

Inherited from base.parameterizedobject.Parameter: constant, default, doc, instantiate, precedence, readonly

Inherited from object: __class__

Method Details [hide private]

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

source code 

Initialize a new Parameter object: store the supplied attributes.

default: the owning class's value for the attribute represented by this Parameter.

precedence is a value, usually in the range 0.0 to 1.0, that allows the order of Parameters in a class to be defined (for e.g. in GUI menus). A negative precedence indicates a parameter that should be hidden in e.g. GUI menus.

default, doc, and precedence default to None. This is to allow inheritance of Parameter slots (attributes) from the owning-class' class hierarchy (see ParameterizedObjectMetaclass).

Overrides: base.parameterclasses.CallableParameter.__init__

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:
'''
    Parameter representing all Parameter classes that are GUI-specific.

    Can be associated with an image when used in a
    TkParameterizedObject 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.

...