Gtk.ActionBar
Gtk.ActionBar — A full width bar for presenting contextual actions
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Bin
╰── Gtk.ActionBar
See also:
Functions:
- new
() -> Gtk.Widget
- pack_start
(self, child:Gtk.Widget)
- pack_end
(self, child:Gtk.Widget)
- get_center_widget
(self) -> Gtk.Widget
- set_center_widget
(self, center_widget:Gtk.Widget=None)
Description:
Gtk.ActionBar
is designed to present contextual actions. It is expected to be displayed below the content and expand horizontally to fill the area.
It allows placing children at the start or the end. In addition, it contains an internal centered box which is centered with respect to the full width of the box, even if the children at either side take up different amounts of space.
Function Details:
new()
new () -> Gtk.Widget
Creates a new Gtk.ActionBar
widget.
Returns: a new Gtk.ActionBar
Since: 3.12
pack_start()
pack_start (self, child:Gtk.Widget)
Adds child
to action_bar
, packed with reference to thestart of the action_bar
.
- Since: 3.12
pack_end()
pack_end (self, child:Gtk.Widget)
Adds child
to action_bar
, packed with reference to theend of the action_bar
.
- Since: 3.12
get_center_widget()
get_center_widget (self) -> Gtk.Widget
Retrieves the center bar widget of the bar.
Returns: the center
Gtk.Widget
.Since: 3.12
set_center_widget()
set_center_widget (self, center_widget:Gtk.Widget=None)
Sets the center widget for the Gtk.ActionBar
.
- Since: 3.12
Example:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class ActionBar(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.set_title("ActionBar")
self.set_default_size(200, 200)
self.connect("destroy", Gtk.main_quit)
grid = Gtk.Grid()
self.add(grid)
label = Gtk.Label()
label.set_vexpand(True)
grid.attach(label, 0, 0, 1, 1)
actionbar = Gtk.ActionBar()
actionbar.set_hexpand(True)
grid.attach(actionbar, 0, 1, 1, 1)
button = Gtk.Button("Cut")
actionbar.pack_start(button)
button = Gtk.Button("Copy")
actionbar.pack_start(button)
button = Gtk.Button("Paste")
actionbar.pack_end(button)
def run(self):
self.show_all()
window = ActionBar()
window.run()
Gtk.main()