Basics
Guides
API Reference
Basics
Guides
API Reference
[25:7] extends: object
A widget that renders SVG, with animations and event handling. GtkSvgWidget
uses [class@Gtk.Svg] internally, and should read its documentation to learn
about the supported SVG features and extensions. On top of the GtkSvg
rendering, GtkSvgWidget adds event handling. Tab and
Shift+Tab keys can be used to move the focus and
Enter and clicks will activate links by emitting the
[signal@Gtk.SvgWidget::activate] signal. The tabindex attribute can be used
to influence what elements act as focus locations. The styling of the SVG
content is following input-related pseudo states such as :focus, :hover
or :visited (for links). If [property@Gtk.Widget:has-tooltip] is set, then
the content of <title> elements will be shown as tooltips. SVG animations
and different <view>s can be triggered by input events as well. See the
SVG animation specification for
details.
SvgWidget ()
Creates a new, empty
GtkSvgWidget.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnActivate (callback Fn, UserData = null)
Emitted when a link or other element is activated. Activating elements can be achieved by clicking or by hitting Enter while the element has focus.
Fn is the Aussom callback.Fn is called with (SvgWidget Self, string Id).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnError (callback Fn, UserData = null)
Signals that an error occurred. Errors can occur both during parsing and during rendering. The expected error values are in the [error@Gtk.SvgError] enumeration, context information about the location of parsing errors can be obtained with the various
gtk_svg_errorfunctions. Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal. ::: note This signal is emitted in the middle of parsing or rendering, and if you handle it, you must be careful. Logging the errors you receive is fine, but modifying the widget hierarchy or changing the paintable state definitively isn't. If in doubt, defer to an idle.
Fn is the Aussom callback.Fn is called with (SvgWidget Self, Error Error).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setResource (string Value)
Writes the
resourceproperty.
Value is the new property value.None.setState (int Value)
Writes the
stateproperty.
Value is the new property value.None.setStylesheet (object Value)
Writes the
stylesheetproperty.
Value is the new property value.None.get_state ()
Gets the current state of the widget.
get_stylesheet ()
Gets the CSS user stylesheet.
load_from_bytes (object bytes)
Loads SVG content into an existing SVG widget. To track errors while loading SVG content, connect to the [signal@Gtk.SvgWidget::error] signal. This clears any previously loaded content.
bytes is the data to data.None.set_state (int state)
Sets the state of the widget. If the paintable is currently playing, the state change will apply transitions that are defined in the SVG. If the paintable is not playing, the state change will take effect instantaneously.
state is the state to set, as a value between 0 and 63.None.set_stylesheet (object bytes)
Sets a CSS user stylesheet to use. Note that styles are applied at load time, so this function must be called before loading SVG.
bytes is CSS data.None.[462:14] static extends: object
Generated metadata helpers for SvgWidget class surfaces.
properties ()
Returns property metadata for
SvgWidget.
A list.signals ()
Returns signal metadata for
SvgWidget.
A list.[391:7] extends: object
Generated low-level callback wrapper for GIR callback error.
SvgWidgetErrorCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, error, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[321:7] extends: object
Generated low-level callback wrapper for GIR callback activate.
SvgWidgetActivateCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, id, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.