gtk.CellRenderera base class for objects that render on a gtk.gdk.DrawableSynopsisgtk.CellRenderergtk.Objectget_sizewidgetcell_areaNonerenderwindowwidgetbackground_areacell_areaexpose_areaflagsactivateeventwidgetpathbackground_areacell_areaflagsstart_editingeventwidgetpathbackground_areacell_areaflagsediting_canceledstop_editingcanceledset_fixed_sizewidthheightget_fixed_sizeset_visiblevisibleget_visibleset_sensitivesensitiveget_sensitiveset_alignmentxalignyalignget_alignmentset_paddingxpadypadget_paddingAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.CellRenderer
gtk.CellRenderer Propertiesgtk.Object Properties
"cell-background"WriteThe background color of the cell as a string. Default: None."cell-background-gdk"Read/WriteThe background color of the cell as a
gtk.gdk.Color."cell-background-set"Read/WriteIf True the cell background color is set by this cellrenderer. Default: False."editing"ReadIf True the cell renderer is currently in editing mode."height"Read/WriteThe fixed height of the cell. Allowed values >= -1. Default: -1."is-expanded"Read/WriteIf True the row has children and it is expanded to show the children. Default: False."is-expander"Read/WriteIf True the row has children. Default: False."mode"Read/WriteThe editable mode of the cellrenderer. One of the
.
Default: gtk.CELL_RENDERER_MODE_INERT,"sensitive"Read/WriteIf True the cell is displayed as sensitive. Available in PyGTK 2.6 and above.
Default: True."visible"Read/WriteIf True the cell is displayed. Default: True."width"Read/WriteThe fixed width of the cell. Allowed values >= -1. Default: -1."xalign"Read/WriteThe fraction of free space to the left
of the cell in the range 0.0 to 1.0. Allowed values between 0 and
1. Default: 0.5."xpad"Read/WriteThe amount of padding to the left and right of the
cell. Default: 0."yalign"Read/WriteThe fraction of free space above the
cell in the range 0.0 to 1.0. Allowed values between 0 and 1.
Default: 0.5."ypad"Read/WriteThe amount of padding above and below cell. Default:
0.
gtk.CellRenderer Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypes"editing-canceled"callbackcellrendereruser_param1..."editing-started"callbackcellrenderereditablepathuser_param1...DescriptionThe gtk.CellRenderer
is a base class for a set of objects used for rendering a cell to a gtk.gdk.Drawable. The
gtk.CellRenderer
provides the common attributes and methods for its subclasses (gtk.CellRendererPixbuf,
gtk.CellRendererText
and gtk.CellRendererToggle).The primary use of a gtk.CellRenderer
is for drawing a certain graphical elements on a gtk.gdk.Drawable. Typically,
one cell renderer is used to draw many cells on the screen. To this
extent, it isn't expected that a CellRenderer keep any permanent state
around. Instead, any state is set just prior to use using the GObjects
property system. Then, the cell is measured using the get_size()
method. Finally, the cell is rendered in the correct location using the
render()
method.Methodsgtk.CellRenderer.get_sizeget_sizewidgetcell_areawidget :the widget the renderer is rendering tocell_area :The area a cell will be allocated, or NoneReturns :a tuple containing the xoffset, yoffset, width and heightThe get_size() method obtains the width
and height needed to render the cell. These values are returned as part of a
tuple containing the x_offset, y_offset, width and height.
get_size() is used by view widgets to determine the
appropriate size for the cell_area to be passed to the gtk.CellRenderer.render()
method. If cell_area is not None,
the x and y offsets of the cell relative to this location are returned.
Please note that the values set in the returned width and height, as well as
those in x_offset and y_offset are inclusive of the xpad and ypad
properties.gtk.CellRenderer.renderrenderwindowwidgetbackground_areacell_areaexpose_areaflagswindow :a gtk.gdk.Drawable to draw towidget :the widget owning windowbackground_area :entire cell area (including tree expanders and maybe padding on the sides)cell_area :area normally rendered by a cell rendererexpose_area :area that actually needs updatingflags :flags that affect renderingThe render() method invokes the virtual
render function of the gtk.CellRenderer.
The three passed-in rectangles are areas of window.
Most renderers will draw within cell_area; the
xalign, yalign, xpad, and ypad properties of the gtk.CellRenderer
should be honored with respect to cell_area.
background_area includes the blank space around the
cell, and also the area containing the tree expander; so the
background_area rectangles for all cells tile to
cover the entire window.
expose_area is a clip rectangle.The flags value is one of:
gtk.CELL_RENDERER_SELECTED,
gtk.CELL_RENDERER_PRELIT,
gtk.CELL_RENDERER_INSENSITIVE or
gtk.CELL_RENDERER_SORTEDgtk.CellRenderer.activateactivateeventwidgetpathbackground_areacell_areaflagsevent :a gtk.gdk.Eventwidget :widget that received the eventpath :widget-dependent string representation of the event location; e.g. for gtk.TreeView, a string representation of gtk.TreePathbackground_area :background area as passed to render()cell_area :cell area as passed to render()flags :render flagsReturns :True if the event was consumed/handledThe activate() method passes an
activate event to the cell renderer for possible processing. Some cell
renderers may use events; for example, gtk.CellRendererToggle
toggles when it gets a mouse click.The flags value is one of:
gtk.CELL_RENDERER_SELECTED,
gtk.CELL_RENDERER_PRELIT,
gtk.CELL_RENDERER_INSENSITIVE or
gtk.CELL_RENDERER_SORTEDgtk.CellRenderer.start_editingstart_editingeventwidgetpathbackground_areacell_areaflagsevent :a gtk.gdk.Eventwidget :the widget that received the eventpath :a widget-dependent string representation of the event location; e.g. for gtk.TreeView, a string representation of gtk.TreePathbackground_area :background area as passed to render().cell_area :cell area as passed to render()flags :render flagsReturns :A new gtk.CellEditable, or NoneThe start_editing() method initiates
the editing of a cell.gtk.CellRenderer.editing_canceledediting_canceledThis method is available in PyGTK 2.4 and above.This method is deprecated in PyGTK 2.6 and above and should not be used in newly-written code. Use the
stop_editing()
method instead.The editing_canceled() method causes
the cell renderer to emit the "editing-canceled" signal. This method is for
use only by implementations of cell renderers that need to notify the client
program that an editing process was canceled and the changes were not
committed.gtk.CellRenderer.stop_editingstop_editingcanceledcanceled :if True the editing has been canceledThis method is available in PyGTK 2.6 and above.The stop_editing() method informs the
cell renderer that the editing is stopped. If
canceled is True, the cell
renderer will emit the "editing-canceled" signal. This method should be
called by cell renderer implementations in response to the "editing-done"
signal of gtk.CellEditable.gtk.CellRenderer.set_fixed_sizeset_fixed_sizewidthheightwidth :the width of the cell renderer, or -1height :the height of the cell renderer, or -1The set_fixed_size() method sets the
renderer size to the specified width and
height, independent of the properties set.gtk.CellRenderer.get_fixed_sizeget_fixed_sizeReturns :a tuple containing the width and height of the cellThe get_fixed_size() method retrieves a
tuple containing the fixed width and
height of the cell.gtk.CellRenderer.set_visibleset_visiblevisiblevisible :the cell renderer's visibility.This method is available in PyGTK 2.22 and above.The set_visible() method sets the cell
renderer's visibility.gtk.CellRenderer.get_visibleget_visibleReturns :the cell renderer's visibility.This method is available in PyGTK 2.22 and above.The get_visible() method gets the cell
renderer's visibility.gtk.CellRenderer.set_sensitiveset_sensitivesensitivesensitive :the cell renderer's sensitivity.This method is available in PyGTK 2.22 and above.The set_sensitive() method sets the cell
renderer's sensitivity.gtk.CellRenderer.get_sensitiveget_sensitiveReturns :the cell renderer's sensitivity.This method is available in PyGTK 2.22 and above.The get_sensitive() method gets the cell
renderer's sensitivity.gtk.CellRenderer.set_alignmentset_alignmentxalignyalignxalign :the x alignment of the cell renderer.yalign :the y alignment of the cell renderer.This method is available in PyGTK 2.22 and above.The set_alignment() method sets the renderer's
alignment within its available space.gtk.CellRenderer.get_alignmentget_alignmentReturns :a 2-tuple containing the cell renderer's alignment within its available space.This method is available in PyGTK 2.22 and above.The get_alignment() gets the the renderer's
alignment within its available space.gtk.CellRenderer.set_paddingset_paddingxpadypadxpad :the x padding of the cell renderer.ypad :the y padding of the cell renderer.This method is available in PyGTK 2.22 and above.The set_padding() method sets the renderer's
padding.gtk.CellRenderer.get_paddingget_paddingReturns :a 2-tuple containing the cell renderer's padding.This method is available in PyGTK 2.22 and above.The get_padding() gets the the renderer's
padding.SignalsThe "editing-canceled" gtk.CellRenderer Signalcallbackcellrendereruser_param1...cellrenderer :the cellrenderer that received the signaluser_param1 :the first user parameter (if any) specified with the connect() method... :additional user parameters (if any)This signal is available in GTK+ 2.4 and above.The "editing-canceled" signal is emitted when the user cancels
the process of editing a cell. For example, an editable cell renderer
could be written to cancel editing when the user presses Escape. Also
see the editing_canceled()
method.The "editing-started" gtk.CellRenderer Signalcallbackcellrenderereditablepathuser_param1...cellrenderer :the cellrenderer that received the signaleditable :the gtk.CellEditablepath :he path identifying the edited celluser_param1 :the first user parameter (if any) specified with the connect() method... :additional user parameters (if any)This signal is available in GTK+ 2.6 and above.The "editing-started" signal is emitted when a cell starts to be
edited. The intended use of this signal is to do special setup on
editable, e.g. adding a gtk.EntryCompletion
or setting up additional columns in a gtk.ComboBox.Note that GTK+ doesn't guarantee that cell renderers will
continue to use the same kind of widget for editing in future releases,
therefore you should check the type of editable before doing any specific
setup, as in the following example:
def text_editing_started(cell, editable, path, data):
if isinstance(editable, gtk.Entry):
# ... create a GtkEntryCompletion
completion = gtk.EntryCompletion()
editable.set_completion(completion)
...
...