Caret, selection, and hotspot styles

The selection is shown by changing the foreground and/or background colours. If one of these is not set then that attribute is not changed for the selection. The default is to show the selection by changing the background to light gray and leaving the foreground the same as when it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention.

Selection style

gtkscintilla.Scintilla.set_sel_style([setting = None | **props])

This method sets the style of the selection. You can pass a gtkscintilla.style.SelStyle instance or props keyword arguments. Available properties are:

Parameters:
  • color – The foreground color of the selected text
  • background – The background color
  • alpha ([0-255] int value.) – The translucency
  • eolfilled (bool) – End of line filled with background color?
gtkscintilla.Scintilla.get_sel_style()
Returns:A gtkscintilla.style.SelStyle instance representing the current style settings.

Caret Style

gtkscintilla.Scintilla.set_caret_style([setting = None | **props])

Sets the caret appearance, the synopsis is like set_sel_style(), the style instance should be a gtkscintilla.style.CaretStyle instance. Available properties are:

Parameters:
  • color – The color of the caret
  • period – Blinking period in milliseconds
  • type – line caret (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all (CARETSTYLE_INVISIBLE=0).
  • width – 0, 1, 2 or 3 pixels.
gtkscintilla.Scintilla.get_caret_style()
Returns:The relative gtkscintilla.style.CaretStyle instance.

Caret Line style

gtkscintilla.Scintilla.set_caret_line_style([setting = None | **props])

Sets the line containing the caret appearance, the synopsis is like set_sel_style(), the style instance should be a gtkscintilla.style.CaretLineStyle instance. Available properties are:

Parameters:
  • visible – Applies or not the background settings.
  • background – Background color
  • background_alpha – Background alpha
gtkscintilla.Scintilla.get_caret_line_style()
Returns:The relative gtkscintilla.style.CaretLineStyle instance.
gtkscintilla.Scintilla.set_caret_sticky(caretSticky)
gtkscintilla.Scintilla.get_caret_sticky()
gtkscintilla.Scintilla.toggle_caret_sticky()
These messages set, get or toggle the caretSticky flag which controls when the last position of the caret on the line is saved. When set to True, the position is not saved when you type a character, a tab, paste the clipboard content or press backspace.

Hotspot Style

gtkscintilla.Scintilla.set_hotspot_active_style([setting = None | **props])

Sets the hotspot “active” appearance, the synopsis is like set_sel_style(), the style instance should be a gtkscintilla.style.HotSpotActiveStyle instance. Available properties are:

Parameters:
  • color – Foreground color
  • background – Background color
  • underline – Is underlined?
gtkscintilla.Scintilla.get_hotspot_active_style()
Returns:The relative gtkscintilla.style.HotSpotActiveStyle instance.

Style Classes

class gtkscintilla.style.SelStyle
class gtkscintilla.style.CaretStyle
class gtkscintilla.style.CaretLineStyle
class gtkscintilla.style.HotSpotActiveStyle

These classes are containers of the style information, they have the respective set of properties defined in the setter methods ( set_sel_style() etc...)

The constructor takes keyword argumets like the setter methods:

>>> st = SelStyle(color="red", background="black")

You can retrieve/modify the properties in this way:

>>> col = st.color
>>> st.background = "gray"

Table Of Contents

Previous topic

Style definition

Next topic

Tabs and Indentation Guides

This Page