import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GObject button = Gtk.Button(label="Click me") button_props = GObject.list_properties(button) prop = button_props.get("label") value = GObject.Value() value.init(prop.value_type) value.set("New label") button.set_property(prop.name, value)
import gi gi.require_version("Gst", "1.0") from gi.repository import Gst, GObject pipeline = Gst.Pipeline() src = Gst.ElementFactory.make("videotestsrc", "src") sink = Gst.ElementFactory.make("autovideosink", "sink") pipeline.add(src) pipeline.add(sink) src.link(sink) caps = Gst.Caps.from_string("video/x-raw,width=640,height=480") src.get_static_pad("src").set_property("caps", caps)In this example, we create a GStreamer pipeline with a video source and sink. We then create a Gst.Caps object to hold the video format information and set its properties using Value. We retrieve the source element's static pad using src.get_static_pad(), which returns a GObject.Value object that we use to set the "caps" property to the caps object. This sets the video format for the source element.