Blame platform-demos/C/buttonbox.py.page

Packit 1470ea
Packit 1470ea
Packit 1470ea
      xmlns:its="http://www.w3.org/2005/11/its"
Packit 1470ea
      xmlns:xi="http://www.w3.org/2001/XInclude"
Packit 1470ea
      type="guide" style="task"
Packit 1470ea
      id="buttonbox.py">
Packit 1470ea
  <info>
Packit 1470ea
    <title type="text">ButtonBox (Python)</title>
Packit 1470ea
    <link type="guide" xref="beginner.py#layout"/>
Packit 1470ea
    <link type="seealso" xref="button.py"/>
Packit 1470ea
    <link type="next" xref="statusbar.py"/>
Packit 1470ea
    <revision version="0.2" date="2012-08-01" status="stub"/>
Packit 1470ea
Packit 1470ea
    <credit type="author copyright">
Packit 1470ea
      <name>Marta Maria Casetti</name>
Packit 1470ea
      <email its:translate="no">mmcasetti@gmail.com</email>
Packit 1470ea
      <years>2012</years>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <desc>A container for arranging buttons</desc>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
  <title>ButtonBox</title>
Packit 1470ea
Packit 1470ea
  <media type="image" mime="image/png" src="media/buttonbox_calculator.png"/>
Packit 1470ea
  

A calculator - the buttons are enclosed in horizontal ButtonBoxes.

Packit 1470ea
Packit 1470ea
  <links type="section" />
Packit 1470ea
Packit 1470ea
  <section id="code">
Packit 1470ea
    <title>Code used to generate this example</title>
Packit 1470ea
    <xi:include href="samples/buttonbox.py" parse="text"><xi:fallback/></xi:include>
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
  <section id="methods">
Packit 1470ea
    <title>Useful methods for a ButtonBox widget</title>
Packit 1470ea
    <list>
Packit 1470ea
      <item>

The layout of the ButtonBox are set with set_layout(layout), where layout can be Gtk.ButtonBoxStyle.SPREAD (buttons are evenly spread across the box), Gtk.ButtonBoxStyle.EDGE (buttons are placed at the edges of the box), Gtk.ButtonBoxStyle.START (buttons are grouped towards the start of the box), Gtk.ButtonBoxStyle.END (buttons are grouped towards the end of the box), Gtk.ButtonBoxStyle.CENTER (buttons are centered in the box).

</item>
Packit 1470ea
      <item>

set_child_secondary(button, is_secondary) sets whether button should appear in a secondary group of children. A typical use of a secondary child is the help button in a dialog. This group appears after the other children if the style is START, SPREAD or EDGE, and before the other children if the style is END. If the style is START or END, then the secondary children are aligned at the other end of the button box from the main children. For the other styles, they appear immediately next to the main children.

</item>
Packit 1470ea
      <item>

set_child_non_homogeneous(button, is_non_homogeneous) sets whether the child is exempted from homogeneous sizing. Default value is False.

</item>
Packit 1470ea
      <item>

set_spacing(spacing) sets the spacing, in pixels, between the buttons of the box.

</item>
Packit 1470ea
    </list>
Packit 1470ea
  </section>
Packit 1470ea
Packit 1470ea
  <section id="references">
Packit 1470ea
    <title>API References</title>
Packit 1470ea
    

In this sample we used the following:

Packit 1470ea
    <list>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/stable/GtkButtonBox.html">GtkButtonBox</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/stable/GtkBox.html">GtkBox</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/stable/GtkButton.html">GtkButton</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/stable/GtkEntry.html">GtkEntry</link>

</item>
Packit 1470ea
      <item>

<link href="http://developer.gnome.org/gtk3/stable/GtkGrid.html">GtkGrid</link>

</item>
Packit 1470ea
    </list>
Packit 1470ea
  </section>
Packit 1470ea
</page>