Gtk.VolumeButton


Gtk.VolumeButton — A button which pops up a volume control

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.Widget
            ╰── Gtk.Container
                ╰── Gtk.Bin
                    ╰── Gtk.Button
                        ╰── Gtk.ScaleButton
                            ╰── Gtk.VolumeButton

Functions:

  • new () -> Gtk.Widget

Description:

Gtk.VolumeButton is a subclass of GtkScaleButton that has been tailored for use as a volume control widget with suitable icons, tooltips and accessible labels.


Function Details:

new()

new () -> Gtk.Widget

Creates a Gtk.VolumeButton, with a range between 0.0 and 1.0, witha stepping of 0.02. Volume values can be obtained and modified usingthe functions from Gtk.ScaleButton.

  • Returns: a new Gtk.VolumeButton

  • Since: 2.12


Example:

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

class VolumeButton(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self)
        self.set_default_size(200, 200)
        self.connect("destroy", Gtk.main_quit)

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

        volumebutton = Gtk.VolumeButton()
        volumebutton.connect("value-changed", self.on_volume_button_changed)
        grid.attach(volumebutton, 0, 0, 1, 1)

    def on_volume_button_changed(self, volumebutton, value):
        print("VolumeButton value: %0.2f" % (value))

window = VolumeButton()
window.show_all()

Gtk.main()

results matching ""

    No results matching ""