| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Module ImageLabel :: Class ImageLabel |
|
object--+ |INotifyable--+ |BaseObject--+ |object--+ | | |Sprite--+ |BaseWidget--+ | ImageLabel
ImageLabel (image) -> ImageLabel
A simple widget class, which can display an image.
The ImageLabel widget is able to display nearly any kind of image and serves as a placeholder widget for simple image displaying.
The image to display can be set with the 'picture' attribute or set_picture() method. The image can be either a file name from which the image should be loaded or a pygame.Surface object to display.
label.picture = './image.png' label.set_picture (image_surface)
If the displayed image is loaded from a file, its file path will be saved in the 'path' attribute. This also can be used to determine, whether the image was loaded from a file ('path' contains a file path) or not ('path' is None).
The ImageLabel supports different border types by setting its 'border' attribute to a valid value of the BORDER_TYPES constants.
label.border = BORDER_SUNKEN label.set_border (BORDER_SUNKEN)
The 'padding' attribute and set_padding() method are used to place a certain amount of pixels between the text and the outer edges of the Label.
label.padding = 10 label.set_padding (10)
Default action (invoked by activate()): None
Mnemonic action (invoked by activate_mnemonic()): None
Attributes: padding - Additional padding between text and borders. Default is 2. picture - A pygame.Surface of the set image. path - The path of the set image (if it is loaded from a file). border - The border style to set for the ImageLabel.| Method Summary | |
|---|---|
__init__(self,
image)
| |
I.draw () -> None | |
I.draw_bg () -> Surface | |
I.set_border (...) -> None | |
I.set_focus (...) -> bool | |
I.set_padding (...) -> None | |
I.set_picture (...) -> None | |
| Inherited from BaseWidget | |
W.activate () -> None | |
W.activate_mnemonic (...) -> bool | |
W.check_sizes (...) -> int, int | |
W.create_style () -> WidgetStyle | |
For debugging usage only | |
W.destroy () -> None | |
W.get_style () -> WidgetStyle | |
B.initclass () -> None (Class method) | |
W.lock () -> None | |
W.notify (...) -> None | |
W.rect_to_client (...) -> pygame.Rect | |
W.set_depth (...) -> None | |
W.set_dirty (...) -> None | |
W.set_entered (...) -> None | |
W.set_event_area (...) -> None | |
W.set_event_manager (...) -> None | |
W.set_index (...) -> None | |
W.set_indexable (...) -> None | |
W.set_maximum_size (...) -> None | |
W.set_minimum_size (...) -> None | |
W.set_opacity (...) -> None | |
W.set_position (...) -> None | |
W.set_sensitive (...) -> None | |
W.set_size (...) -> None | |
W.set_state (...) -> None | |
W.set_style (...) -> None | |
W.set_tooltip (...) -> None | |
W.unlock () -> None | |
W.update (...) -> None | |
| Inherited from BaseObject | |
B.connect_signal (...) -> EventCallback | |
B.disconnect_signal (...) -> None | |
B.emit (...) -> bool | |
B.run_signal_handlers (...) -> None | |
| Inherited from Sprite | |
| |
add(group or list of of groups, ...) add a sprite to container | |
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
border: The border style to set for the ImageLabel. | |
padding: Additional padding between image and borders. | |
path: The file path of the image. | |
picture: The image to display on the ImageLabel. | |
| Inherited from BaseWidget | |
bottom | |
bottomleft | |
bottomright | |
center | |
centerx | |
centery | |
controls: Widgets associated with the widget. | |
depth: The z-axis layer depth of the widget. | |
dirty: Indicates, whether the widget need to be redrawn. | |
entered: Indicates, whether the widget is entered. | |
eventarea: The area, which gets the events. | |
focus: The focus of the widget. | |
h | |
height | |
image: The visible surface of the widget. | |
index: The tab index position of the widget. | |
indexable: The IIndexable, the widget is attached to. | |
left | |
locked: Indicates, whether the widget is locked. | |
maxsize: The maximum size to occupy by the widget. | |
midbottom | |
midleft | |
midright | |
midtop | |
minsize: The guaranteed size of the widget. | |
opacity: The opacity of the widget. | |
position: The position of the topleft corner. | |
rect: The area occupied by the widget. | |
right | |
sensitive: The sensitivity of the widget. | |
size | |
state: The current state of the widget. | |
style: The style of the widget. | |
tooltip: The tool tip text to display for the widget. | |
top | |
topleft | |
topright | |
w | |
width | |
x | |
y | |
| Inherited from BaseObject | |
manager: The event manager to use by the object. | |
| Instance Method Details |
|---|
draw(self)I.draw () -> None Draws the ImageLabel surface and places its picture on it.
|
draw_bg(self)I.draw_bg () -> Surface Draws the ImageLabel background surface and returns it. Creates the visible background surface of the ImageLabel and returns it to the caller. |
set_border(self, border)I.set_border (...) -> None Sets the border type to be used by the ImageLabel. Raises a ValueError, if the passed argument is not a value from BORDER_TYPES |
set_focus(self, focus=True)I.set_focus (...) -> bool Overrides the default widget input focus. ImageLabels cannot be focused by default, thus this method always returns False and does not do anything. |
set_padding(self, padding)I.set_padding (...) -> None Sets the padding between the edges and image of the ImageLabel. The padding value is the amount of pixels to place between the edges of the Label and the displayed text. Raises a TypeError, if the passed argument is not a positive integer. Note: If the 'size' attribute is set, it can influence the visible space between the text and the edges. That does not mean, that any padding is set. |
set_picture(self, image)I.set_picture (...) -> None Sets the image to be displayed on the ImageLabel. The image can be either a valid pygame.Surface object or the path to an image file. If the argument is a file, the 'path' attribute will be set to the file path, otherwise it will be None. Raises a TypeError, if the passed argument is not a string, unicode or pygame.Surface. |
| Property Details |
|---|
borderThe border style to set for the ImageLabel.
|
paddingAdditional padding between image and borders.
|
pathThe file path of the image.
|
pictureThe image to display on the ImageLabel.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 | http://epydoc.sf.net |