sugar4.graphics.radiopalette

Radio palette provides a way to create radio button groups within palettes, allowing users to select one option from multiple choices.

This implementation modernizes the radio palette system while maintaining compatibility with Sugar’s palette interface patterns.

Example

Create a radio palette with multiple tool options.

from gi.repository import Gtk
from sugar4.graphics.radiopalette import RadioToolsButton, RadioPalette
from sugar4.graphics.toolbutton import ToolButton

# Create the main radio button
radio_button = RadioToolsButton(
    icon_name='tool-brush',
    tooltip='Drawing Tools'
)

# Create the palette
palette = RadioPalette(primary_text='Drawing Tools')
radio_button.set_palette(palette)

# Add tool options
brush_btn = ToolButton(icon_name='tool-brush')
palette.append(brush_btn, 'Brush')

pen_btn = ToolButton(icon_name='tool-pen')
palette.append(pen_btn, 'Pen')

Attributes

logger

print

Classes

RadioMenuButton

A toolbar button that shows a radio palette when clicked.

RadioToolsButton

A toolbar button that shows a radio palette when clicked.

RadioPalette

A palette containing radio button options.

Module Contents

sugar4.graphics.radiopalette.logger[source]
sugar4.graphics.radiopalette.print[source]
class sugar4.graphics.radiopalette.RadioMenuButton(**kwargs)[source]

Bases: sugar4.graphics.toolbutton.ToolButton

A toolbar button that shows a radio palette when clicked.

selected_button = None[source]
get_selected_button()[source]
set_selected_button(button)[source]
class sugar4.graphics.radiopalette.RadioToolsButton(**kwargs)[source]

Bases: RadioMenuButton

A toolbar button that shows a radio palette when clicked.

do_clicked()[source]
class sugar4.graphics.radiopalette.RadioPalette(**kwargs)[source]

Bases: sugar4.graphics.palette.Palette

A palette containing radio button options.

button_box[source]
append(button, label)[source]

Add a button option to the radio palette.

Parameters:
  • button – The ToolButton to add to the radio group

  • label – The label text for this option

update_button()[source]
popdown(immediate=True)[source]

Hide the palette.

Parameters:
  • immediate (bool) – if True, hide instantly. If False, use animation.

  • state – deprecated parameter, ignored.

popup(immediate=True)[source]

Show the palette.

get_buttons()[source]
get_selected_button()[source]