Gtk.TextView


Gtk.TextView — Widget that displays a Gtk.TextBuffer

Object Hierarchy:

    GObject
    ├── GInitiallyUnowned
    │   ╰── Gtk.Widget
    │       ╰── Gtk.Container
    │           ╰── Gtk.TextView
    ╰── Gtk.TextChildAnchor

See also:

Gtk.TextBuffer, Gtk.TextIter


Functions:


Signals:

  • “backspace” (text_view, user_data)
  • “copy-clipboard” (text_view, user_data)
  • “cut-clipboard” (text_view, user_data)
  • “delete-from-cursor” (text_view, type, count, user_data)
  • “extend-selection” (text_view, granularity, location, start, end, user_data)
  • “insert-at-cursor” (text_view, string, user_data)
  • “move-cursor” (text_view, step, count, extend_selection, user_data)
  • “move-viewport” (text_view, step, count, user_data)
  • “paste-clipboard” (text_view, user_data)
  • “populate-popup” (text_view, popup, user_data)
  • “preedit-changed” (text_view, preedit, user_data)
  • “select-all” (text_view, select, user_data)
  • “set-anchor” (text_view, user_data)
  • “toggle-cursor-visible” (text_view, user_data)

Description:

You may wish to begin by reading the [text widget conceptual overview][TextWidget] which gives an overview of all the objects and data types related to the text widget and how they work together.


Function Details:

new()

new () -> Gtk.Widget

Creates a new Gtk.TextView. If you don’t call Gtk.TextView:set_buffer()before using the text view, an empty default buffer will be createdfor you. Get the buffer with Gtk.TextView:get_buffer(). If you wantto specify your own buffer, consider Gtk.TextView:new_with_buffer().

  • Returns: a new Gtk.TextView

new_with_buffer()

new_with_buffer (buffer:Gtk.TextBuffer) -> Gtk.Widget

Creates a new Gtk.TextView widget displaying the bufferbuffer. One buffer can be shared among many widgets.buffer may be None to create a default buffer, in which casethis function is equivalent to Gtk.TextView:new(). Thetext view adds its own reference count to the buffer; it does nottake over an existing reference.

  • Returns: a new Gtk.TextView.

set_buffer()

set_buffer (self, buffer:Gtk.TextBuffer=None)

Sets buffer as the buffer being displayed by text_view. The previousbuffer displayed by the text view is unreferenced, and a reference isadded to buffer. If you owned a reference to buffer before passing itto this function, you must remove that reference yourself; Gtk.TextViewwill not “adopt” it.


get_buffer()

get_buffer (self) -> Gtk.TextBuffer

Returns the Gtk.TextBuffer being displayed by this text view.The reference count on the buffer is not incremented; the callerof this function won’t own a new reference.

  • Returns: a Gtk.TextBuffer.

get_hadjustment()

get_hadjustment (self) -> Gtk.Adjustment

Gtk.TextView:get_hadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:get_hadjustment()Gets the horizontal-scrollingGtk.Adjustment`.

  • Returns: pointer to the horizontal Gtk.Adjustment.

  • Since: 2.22


get_vadjustment()

get_vadjustment (self) -> Gtk.Adjustment

Gtk.TextView:get_vadjustment has been deprecated since version 3.0 and should not be used in newly-written code. Use `Gtk.Scrollable:get_vadjustment()Gets the vertical-scrollingGtk.Adjustment`.

  • Returns: pointer to the vertical Gtk.Adjustment.

  • Since: 2.22


scroll_to_mark()

scroll_to_mark (self, mark:Gtk.TextMark, within_margin:float, use_align:bool, xalign:float, yalign:float)

Scrolls text_view so that mark is on the screen in the positionindicated by xalign and yalign. An alignment of 0.0 indicatesleft or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is FALSE, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin.


scroll_to_iter()

scroll_to_iter (self, iter:Gtk.TextIter, within_margin:float, use_align:bool, xalign:float, yalign:float) -> bool

Scrolls text_view so that iter is on the screen in the positionindicated by xalign and yalign. An alignment of 0.0 indicatesleft or top, 1.0 indicates right or bottom, 0.5 means center.If use_align is FALSE, the text scrolls the minimal distance toget the mark onscreen, possibly not scrolling at all. The effectivescreen for purposes of this function is reduced by a margin of sizewithin_margin. Note that this function uses the currently-computed height of thelines in the text buffer. Line heights are computed in an idlehandler; so this function may not have the desired effect if it’scalled before the height computations. To avoid oddness, considerusing Gtk.TextView:scroll_to_mark() which saves a point to bescrolled to after line validation.

  • Returns: True if scrolling occurred

scroll_mark_onscreen()

scroll_mark_onscreen (self, mark:Gtk.TextMark)

Scrolls text_view the minimum distance such that mark is containedwithin the visible area of the widget.


move_mark_onscreen()

move_mark_onscreen (self, mark:Gtk.TextMark) -> bool

Moves a mark within the buffer so that it'slocated within the currently-visible text area.

  • Returns: True if the mark moved (wasn’t already onscreen)

place_cursor_onscreen()

place_cursor_onscreen (self) -> bool

Moves the cursor to the currently visible region of thebuffer, it it isn’t there already.

  • Returns: True if the cursor had to be moved.

get_visible_rect()

get_visible_rect (self) -> visible_rect:Gdk.Rectangle

Fills visible_rect with the currently-visibleregion of the buffer, in buffer coordinates. Convert to window coordinateswith Gtk.TextView:buffer_to_window_coords().


get_iter_location()

get_iter_location (self, iter:Gtk.TextIter) -> location:Gdk.Rectangle

Gets a rectangle which roughly contains the character at iter.The rectangle position is in buffer coordinates; useGtk.TextView:buffer_to_window_coords() to convert thesecoordinates to coordinates for one of the windows in the text view.


get_cursor_locations()

get_cursor_locations (self, iter:Gtk.TextIter=None) -> strong:Gdk.Rectangle, weak:Gdk.Rectangle

Given an iter within a text layout, determine the positions of thestrong and weak cursors if the insertion point is at thatiterator. The position of each cursor is stored as a zero-widthrectangle. The strong cursor location is the location wherecharacters of the directionality equal to the base direction of theparagraph are inserted. The weak cursor location is the locationwhere characters of the directionality opposite to the basedirection of the paragraph are inserted. If iter is None, the actual cursor position is used. Note that if iter happens to be the actual cursor position, andthere is currently an IM preedit sequence being entered, thereturned locations will be adjusted to account for the preeditcursor’s offset within the preedit sequence. The rectangle position is in buffer coordinates; useGtk.TextView:buffer_to_window_coords() to convert thesecoordinates to coordinates for one of the windows in the text view.

  • Since: 3.0

get_line_at_y()

get_line_at_y (self, y:int) -> target_iter:Gtk.TextIter, line_top:int

Gets the Gtk.TextIter at the start of the line containingthe coordinate y. y is in buffer coordinates, convert fromwindow coordinates with Gtk.TextView:window_to_buffer_coords().If non-None, line_top will be filled with the coordinate of the topedge of the line.


get_line_yrange()

get_line_yrange (self, iter:Gtk.TextIter) -> y:int, height:int

Gets the y coordinate of the top of the line containing iter,and the height of the line. The coordinate is a buffer coordinate;convert to window coordinates with Gtk.TextView:buffer_to_window_coords().


get_iter_at_location()

get_iter_at_location (self, x:int, y:int) -> iter:Gtk.TextIter

Retrieves the iterator at buffer coordinates x and y. Buffercoordinates are coordinates for the entire buffer, not just thecurrently-displayed portion. If you have coordinates from anevent, you have to convert those to buffer coordinates withGtk.TextView:window_to_buffer_coords().


get_iter_at_position()

get_iter_at_position (self, x:int, y:int) -> iter:Gtk.TextIter, trailing:int

Retrieves the iterator pointing to the character at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with Gtk.TextView:window_to_buffer_coords(). Note that this is different from Gtk.TextView:get_iter_at_location(),which returns cursor locations, i.e. positions betweencharacters.

  • Since: 2.6

buffer_to_window_coords()

buffer_to_window_coords (self, win:Gtk.TextWindowType, buffer_x:int, buffer_y:int) -> window_x:int, window_y:int

Converts coordinate (buffer_x, buffer_y) to coordinates for the windowwin, and stores the result in (window_x, window_y). Note that you can’t convert coordinates for a nonexisting window (see Gtk.TextView:set_border_window_size()).


window_to_buffer_coords()

window_to_buffer_coords (self, win:Gtk.TextWindowType, window_x:int, window_y:int) -> buffer_x:int, buffer_y:int

Converts coordinates on the window identified by win to buffercoordinates, storing the result in (buffer_x,buffer_y). Note that you can’t convert coordinates for a nonexisting window (see Gtk.TextView:set_border_window_size()).


get_window()

get_window (self, win:Gtk.TextWindowType) -> Gdk.Window

Retrieves the GdkWindow corresponding to an area of the text view;possible windows include the overall widget window, child windowson the left, right, top, bottom, and the window that displays thetext buffer. Windows are None and nonexistent if their width orheight is 0, and are nonexistent before the widget has beenrealized.

  • Returns: a GdkWindow, or None.

get_window_type()

get_window_type (self, window:Gdk.Window) -> Gtk.TextWindowType

Usually used to find out which window an event corresponds to.If you connect to an event signal on text_view, this functionshould be called on event->window tosee which window it was.

  • Returns: the window type.

set_border_window_size()

set_border_window_size (self, type:Gtk.TextWindowType, size:int)

Sets the width of GTK_TEXT_WINDOW_LEFT or GTK_TEXT_WINDOW_RIGHT,or the height of GTK_TEXT_WINDOW_TOP or GTK_TEXT_WINDOW_BOTTOM.Automatically destroys the corresponding window if the size is setto 0, and creates the window if the size is set to non-zero. Thisfunction can only be used for the “border windows,” it doesn’t workwith GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_TEXT, orGTK_TEXT_WINDOW_PRIVATE.


get_border_window_size()

get_border_window_size (self, type:Gtk.TextWindowType) -> int

Gets the width of the specified border window. SeeGtk.TextView:set_border_window_size().

  • Returns: width of window

forward_display_line()

forward_display_line (self, iter:Gtk.TextIter) -> bool

Moves the given iter forward by one display (wrapped) line.A display line is different from a paragraph. Paragraphs areseparated by newlines or other paragraph separator characters.Display lines are created by line-wrapping a paragraph. Ifwrapping is turned off, display lines and paragraphs will be thesame. Display lines are divided differently for each view, sincethey depend on the view’s width; paragraphs are the same in allviews, since they depend on the contents of the Gtk.TextBuffer.

  • Returns: True if iterwas moved and is not on the end iterator

backward_display_line()

backward_display_line (self, iter:Gtk.TextIter) -> bool

Moves the given iter backward by one display (wrapped) line.A display line is different from a paragraph. Paragraphs areseparated by newlines or other paragraph separator characters.Display lines are created by line-wrapping a paragraph. Ifwrapping is turned off, display lines and paragraphs will be thesame. Display lines are divided differently for each view, sincethey depend on the view’s width; paragraphs are the same in allviews, since they depend on the contents of the Gtk.TextBuffer.

  • Returns: True if iterwas moved and is not on the end iterator

forward_display_line_end()

forward_display_line_end (self, iter:Gtk.TextIter) -> bool

Moves the given iter forward to the next display line end.A display line is different from a paragraph. Paragraphs areseparated by newlines or other paragraph separator characters.Display lines are created by line-wrapping a paragraph. Ifwrapping is turned off, display lines and paragraphs will be thesame. Display lines are divided differently for each view, sincethey depend on the view’s width; paragraphs are the same in allviews, since they depend on the contents of the Gtk.TextBuffer.

  • Returns: True if iterwas moved and is not on the end iterator

backward_display_line_start()

backward_display_line_start (self, iter:Gtk.TextIter) -> bool

Moves the given iter backward to the next display line start.A display line is different from a paragraph. Paragraphs areseparated by newlines or other paragraph separator characters.Display lines are created by line-wrapping a paragraph. Ifwrapping is turned off, display lines and paragraphs will be thesame. Display lines are divided differently for each view, sincethey depend on the view’s width; paragraphs are the same in allviews, since they depend on the contents of the Gtk.TextBuffer.

  • Returns: True if iterwas moved and is not on the end iterator

starts_display_line()

starts_display_line (self, iter:Gtk.TextIter) -> bool

Determines whether iter is at the start of a display line.See Gtk.TextView:forward_display_line() for an explanation ofdisplay lines vs. paragraphs.

  • Returns: True if iterbegins a wrapped line

move_visually()

move_visually (self, iter:Gtk.TextIter, count:int) -> bool

Move the iterator a given number of characters visually, treatingit as the strong cursor position. If count is positive, then thenew strong cursor position will be count positions to the right ofthe old cursor position. If count is negative then the new strongcursor position will be count positions to the left of the oldcursor position. In the presence of bi-directional text, the correspondencebetween logical and visual order will depend on the directionof the current run, and there may be jumps when the cursoris moved off of the end of a run.

  • Returns: True if itermoved and is not on the end iterator

add_child_at_anchor()

add_child_at_anchor (self, child:Gtk.Widget, anchor:Gtk.TextChildAnchor)

Adds a child widget in the text buffer, at the given anchor.


add_child_in_window()

add_child_in_window (self, child:Gtk.Widget, which_window:Gtk.TextWindowType, xpos:int, ypos:int)

Adds a child at fixed coordinates in one of the text widget'swindows. The window must have nonzero size (seeGtk.TextView:set_border_window_size()). Note that the childcoordinates are given relative to scrolling. Whenplacing a child in GTK_TEXT_WINDOW_WIDGET, scrolling isirrelevant, the child floats above all scrollable areas. But whenplacing a child in one of the scrollable windows (border windows ortext window) it will move with the scrolling as needed.


move_child()

move_child (self, child:Gtk.Widget, xpos:int, ypos:int)

Updates the position of a child, as for Gtk.TextView:add_child_in_window().


set_wrap_mode()

set_wrap_mode (self, wrap_mode:Gtk.WrapMode)

Sets the line wrapping for the view.


get_wrap_mode()

get_wrap_mode (self) -> Gtk.WrapMode

Gets the line wrapping for the view.

  • Returns: the line wrap setting

set_editable()

set_editable (self, setting:bool)

Sets the default editability of the Gtk.TextView. You can overridethis default setting with tags in the buffer, using the “editable”attribute of tags.


get_editable()

get_editable (self) -> bool

Returns the default editability of the Gtk.TextView. Tags in thebuffer may override this setting for some ranges of text.

  • Returns: whether text is editable by default

set_cursor_visible()

set_cursor_visible (self, setting:bool)

Toggles whether the insertion point is displayed. A buffer with no editabletext probably shouldn’t have a visible cursor, so you may want to turnthe cursor off.


get_cursor_visible()

get_cursor_visible (self) -> bool

Find out whether the cursor is being displayed.

  • Returns: whether the insertion mark is visible

set_overwrite()

set_overwrite (self, overwrite:bool)

Changes the Gtk.TextView overwrite mode.

  • Since: 2.4

get_overwrite()

get_overwrite (self) -> bool

Returns whether the Gtk.TextView is in overwrite mode or not.

  • Returns: whether text_viewis in overwrite mode or not.

  • Since: 2.4


set_pixels_above_lines()

set_pixels_above_lines (self, pixels_above_lines:int)

Sets the default number of blank pixels above paragraphs in text_view.Tags in the buffer for text_view may override the defaults.


get_pixels_above_lines()

get_pixels_above_lines (self) -> int

Gets the default number of pixels to put above paragraphs.

  • Returns: default number of pixels above paragraphs

set_pixels_below_lines()

set_pixels_below_lines (self, pixels_below_lines:int)

Sets the default number of pixels of blank spaceto put below paragraphs in text_view. May be overriddenby tags applied to text_view’s buffer.


get_pixels_below_lines()

get_pixels_below_lines (self) -> int

Gets the value set by Gtk.TextView:set_pixels_below_lines().

  • Returns: default number of blank pixels below paragraphs

set_pixels_inside_wrap()

set_pixels_inside_wrap (self, pixels_inside_wrap:int)

Sets the default number of pixels of blank space to leave betweendisplay/wrapped lines within a paragraph. May be overridden bytags in text_view’s buffer.


get_pixels_inside_wrap()

get_pixels_inside_wrap (self) -> int

Gets the value set by Gtk.TextView:set_pixels_inside_wrap().

  • Returns: default number of pixels of blank space between wrapped lines

set_justification()

set_justification (self, justification:Gtk.Justification)

Sets the default justification of text in text_view.Tags in the view’s buffer may override the default.


get_justification()

get_justification (self) -> Gtk.Justification

Gets the default justification of paragraphs in text_view.Tags in the buffer may override the default.

  • Returns: default justification

set_left_margin()

set_left_margin (self, left_margin:int)

Sets the default left margin for text in text_view.Tags in the buffer may override the default. Note that this function is confusingly named.In CSS terms, the value set here is padding.


get_left_margin()

get_left_margin (self) -> int

Gets the default left margin size of paragraphs in the text_view.Tags in the buffer may override the default.

  • Returns: left margin in pixels

set_right_margin()

set_right_margin (self, right_margin:int)

Sets the default right margin for text in the text view.Tags in the buffer may override the default. Note that this function is confusingly named.In CSS terms, the value set here is padding.


get_right_margin()

get_right_margin (self) -> int

Gets the default right margin for text in text_view. Tagsin the buffer may override the default.

  • Returns: right margin in pixels

set_top_margin()

set_top_margin (self, top_margin:int)

Sets the top margin for text in text_view. Note that this function is confusingly named.In CSS terms, the value set here is padding.

  • Since: 3.18

get_top_margin()

get_top_margin (self) -> int

Gets the top margin for text in the text_view.

  • Returns: top margin in pixels

  • Since: 3.18


set_bottom_margin()

set_bottom_margin (self, bottom_margin:int)

Sets the bottom margin for text in text_view. Note that this function is confusingly named.In CSS terms, the value set here is padding.

  • Since: 3.18

get_bottom_margin()

get_bottom_margin (self) -> int

Gets the bottom margin for text in the text_view.

  • Returns: bottom margin in pixels

  • Since: 3.18


set_indent()

set_indent (self, indent:int)

Sets the default indentation for paragraphs in text_view.Tags in the buffer may override the default.


get_indent()

get_indent (self) -> int

Gets the default indentation of paragraphs in text_view.Tags in the view’s buffer may override the default.The indentation may be negative.

  • Returns: number of pixels of indentation

set_tabs()

set_tabs (self, tabs:Pango.TabArray)

Sets the default tab stops for paragraphs in text_view.Tags in the buffer may override the default.


get_tabs()

get_tabs (self) -> Pango.TabArray

Gets the default tabs for text_view. Tags in the buffer mayoverride the defaults. The returned array will be None if“standard” (8-space) tabs are used. Free the return valuewith pango_tab_array_free().

  • Returns: copy of default tab array, or None if “standard”tabs are used; must be freed with pango_tab_array_free().

set_accepts_tab()

set_accepts_tab (self, accepts_tab:bool)

Sets the behavior of the text widget when the Tab key is pressed. If accepts_tab is True, a tab character is inserted. If accepts_tab is FALSE the keyboard focus is moved to the next widget in the focus chain.

  • Since: 2.4

get_accepts_tab()

get_accepts_tab (self) -> bool

Returns whether pressing the Tab key inserts a tab characters.Gtk.TextView:set_accepts_tab().

  • Returns: True if pressing the Tab key inserts a tab character,FALSE if pressing the Tab key moves the keyboard focus.

  • Since: 2.4


get_default_attributes()

get_default_attributes (self) -> Gtk.TextAttributes

Obtains a copy of the default text attributes. These are theattributes used for text unless a tag overrides them.You’d typically pass the default attributes in toGtk.TextIter:get_attributes`()` in order to get theattributes in effect at a given text position. The return value is a copy owned by the caller of this function,and should be freed withGtk.TextAttributes:unref().

  • Returns: a new Gtk.TextAttributes

im_context_filter_keypress()

im_context_filter_keypress (self, event:Gdk.EventKey) -> bool

Allow the Gtk.TextView input method to internally handle key pressand release events. If this function returns True, then no furtherprocessing should be done for this key event. See`Gtk.IMContext:filter_keypress(). Note that you are expected to call this function from your handlerwhen overriding key event handling. This is needed in the case whenyou need to insert your own key handling between the input methodand the default key event handling of theGtk.TextView. static gbooleanGtk.FooBar:key_press_event(Gtk.Widget*widget, GdkEventKey *event){ if ((key->keyval == GDK_KEY_Return || key->keyval == GDK_KEY_KP_Enter)) { if (Gtk.TextView:im_context_filter_keypress (GTK_TEXT_VIEW (view), event)) return True; } // Do some stuff return GTK_WIDGET_CLASS (Gtk.FooBar:parent_class)->key_press_event` (widget, event);}

  • Returns: True if the input method handled the key event.

  • Since: 2.22


reset_im_context()

reset_im_context (self)

Reset the input method context of the text view if needed. This can be necessary in the case where modifying the bufferwould confuse on-going input method behavior.

  • Since: 2.22

set_input_purpose()

set_input_purpose (self, purpose:Gtk.InputPurpose)

Sets the “input-purpose” property whichcan be used by on-screen keyboards and other inputmethods to adjust their behaviour.

  • Since: 3.6

get_input_purpose()

get_input_purpose (self) -> Gtk.InputPurpose

Gets the value of the “input-purpose” property.

  • Since: 3.6

set_input_hints()

set_input_hints (self, hints:Gtk.InputHints)

Sets the “input-hints” property, whichallows input methods to fine-tune their behaviour.

  • Since: 3.6

get_input_hints()

get_input_hints (self) -> Gtk.InputHints

Gets the value of the “input-hints” property.

  • Since: 3.6

set_monospace()

set_monospace (self, monospace:bool)

Sets the “monospace” property, whichindicates that the text view should use monospacefonts.

  • Since: 3.16

get_monospace()

get_monospace (self) -> bool

Gets the value of the “monospace” property. Return: True if monospace fonts are desired

  • Since: 3.16

Example:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Pango

def set_wrap_mode(radiobutton, wrap_mode):
    textview.set_wrap_mode(wrap_mode)

def set_style_text(checkbutton):
    start, end = textbuffer.get_bounds()

    if checkbuttonBold.get_active():
        textbuffer.apply_tag(texttagBold, start, end)
    else:
        textbuffer.remove_tag(texttagBold, start, end)

    if checkbuttonItalic.get_active():
        textbuffer.apply_tag(texttagItalic, start, end)
    else:
        textbuffer.remove_tag(texttagItalic, start, end)

    if checkbuttonUnderline.get_active():
        textbuffer.apply_tag(texttagUnderline, start, end)
    else:
        textbuffer.remove_tag(texttagUnderline, start, end)

    if checkbuttonColor.get_active():
        textbuffer.apply_tag(texttagColor, start, end)
    else:
        textbuffer.remove_tag(texttagColor, start, end)

window = Gtk.Window()
window.set_default_size(250, 300)
window.connect("destroy", Gtk.main_quit)

grid = Gtk.Grid()
window.add(grid)

scrolledwindow = Gtk.ScrolledWindow()
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
grid.attach(scrolledwindow, 0, 0, 2, 1)

textbuffer = Gtk.TextBuffer()
texttagBold = textbuffer.create_tag("Bold", weight=Pango.Weight.BOLD)
texttagItalic = textbuffer.create_tag("Italic", style=Pango.Style.ITALIC)
texttagUnderline = textbuffer.create_tag("Underline", underline=Pango.Underline.SINGLE)
texttagColor = textbuffer.create_tag("foreground", foreground='#0000FF')
textbuffer.set_text("GTK+, or the GIMP Toolkit, is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off tools to complete application suites.")

textview = Gtk.TextView(buffer=textbuffer)
textview.set_vexpand(True)
textview.set_hexpand(True)
scrolledwindow.add(textview)

radiobuttonWrapNone = Gtk.RadioButton(group=None, label="None")
radiobuttonWrapNone.connect("toggled", set_wrap_mode, Gtk.WrapMode.NONE)
grid.attach(radiobuttonWrapNone, 0, 1, 1, 1)

radiobuttonWrapChar = Gtk.RadioButton(group=radiobuttonWrapNone, label="Character")
radiobuttonWrapChar.connect("toggled", set_wrap_mode, Gtk.WrapMode.CHAR)
grid.attach(radiobuttonWrapChar, 0, 2, 1, 1)

radiobuttonWrapWord = Gtk.RadioButton(group=radiobuttonWrapNone, label="Word")
radiobuttonWrapWord.connect("toggled", set_wrap_mode, Gtk.WrapMode.WORD)
grid.attach(radiobuttonWrapWord, 0, 3, 1, 1)

radiobuttonWrapWordChar = Gtk.RadioButton(group=radiobuttonWrapNone, label="Word & Character")
radiobuttonWrapWordChar.connect("toggled", set_wrap_mode, Gtk.WrapMode.WORD_CHAR)
grid.attach(radiobuttonWrapWordChar, 0, 4, 1, 1)

checkbuttonBold = Gtk.CheckButton(label="Bold")
checkbuttonBold.connect("toggled", set_style_text)
grid.attach(checkbuttonBold, 1, 1, 1, 1)

checkbuttonItalic = Gtk.CheckButton(label="Italic")
checkbuttonItalic.connect("toggled", set_style_text)
grid.attach(checkbuttonItalic, 1, 2, 1, 1)

checkbuttonUnderline = Gtk.CheckButton(label="Underline")
checkbuttonUnderline.connect("toggled", set_style_text)
grid.attach(checkbuttonUnderline, 1, 3, 1, 1)

checkbuttonColor = Gtk.CheckButton(label="Blue Color")
checkbuttonColor.connect("toggled", set_style_text)
grid.attach(checkbuttonColor, 1, 4, 1, 1)

window.show_all()

Gtk.main()

results matching ""

    No results matching ""