Background

../_images/background-preview.png

Widget description

The background widget is used for setting a solid color, image or Edje group as a background to a window (unless it has transparency enabled) or any container object.

It works just like an image, but has some properties useful to a background, like setting it to tiled, centered, scaled or stretched.

Layout content parts

  • overlay - overlay of the bg

Enumerations

Background display modes

efl.elementary.ELM_BG_OPTION_CENTER

Center

efl.elementary.ELM_BG_OPTION_SCALE

Scale

efl.elementary.ELM_BG_OPTION_STRETCH

Stretch

efl.elementary.ELM_BG_OPTION_TILE

Tile

Inheritance diagram

Inheritance diagram of Background

class efl.elementary.Background(Object parent, *args, **kwargs)

Bases: efl.elementary.__init__.LayoutClass

Parameters:
  • parent (efl.evas.Object) – The parent object
  • **kwargs – All the remaining keyword arguments are interpreted as properties of the instance
color

The color on a given background widget.

This property reflects the color used for the background rectangle, in RGB format. Each color component’s range is from 0 to 255.

Note

You probably only want to use this property if you haven’t previously set file, so that you just want a solid color background.

Type:(int r, int g, int b)
color_get()
color_set(r, g, b)
file

The file (image or edje collection) giving life for the background.

This property contains the image file name (and edje group) used in the background object. If the image comes from an Edje group, it will be stretched to completely fill the background object. If it comes from a traditional image file, it will by default be centered in this widget’s are (thus retaining its aspect), what could lead to some parts being not visible. You may change the mode of exhibition for a real image file with option.

Note

Once the image is set, a previously set one will be deleted, even if file is None.

Note

This will only affect the contents of one of the background’s swallow spots, namely “elm.swallow.background”. If you want to achieve the efl.elementary.layout_class.LayoutClass‘s file setting behavior, you’ll have to call that method on this object.

Type:string file, optional string group
Raises:RuntimeError – if setting the file failed.
file_get()
file_set(filename, group=None)
load_size

The size of the pixmap representation of the image set on a given background widget.

This property sets a new size for pixmap representation of the given bg image. It allows for the image to be loaded already in the specified size, reducing the memory usage and load time (for example, when loading a big image file with its load size set to a smaller size)

Note

This is just a hint for the underlying system. The real size of the pixmap may differ depending on the type of image being loaded, being bigger than requested.

Warning

This function just makes sense if an image file was set with file.

Type:(int w, int h)
load_size_set(w, h)
option

The mode of display for a given background widget’s image.

This property reflects how the background widget will display its image. This will only work if file was previously set with an image file. The image can be displayed tiled, scaled, centered or stretched.

Type:Background display modes
option_get()
option_set(option)