sgc Package

All widgets are imported into sgc namespace. This means you can access widgets in sgc namespace, such as sgc.Button.

Module Packages:
widgets: All the widgets available for use in this toolkit.
locals: Constants to be imported into the local namespace for convenience.
surface: Extended pygame.surface classes.
class Font

Class containing fonts available for use.

Index class to get fonts, such as Font["widget"] for the widget font.

The default fonts are:
widget: The default font for widgets.
title: A larger title font.
mono: A monospaced font.
col: (r,g,b) tuple, containing the default font colour.
col = (255, 255, 255)
classmethod set_fonts(fonts={})

Set fonts to a specific font. If a font exists, it will be replaced, otherwise it will be newly created.

fonts: Dictionary containing fonts to use.
Key should be name of font. Value should be string
naming either custom FreeType or a system font.

Updates all active widgets or modal widgets each frame.


Send event to focused widget and handle widget focus.

locals Module

Imports useful objects into the local namespace.

GUI: Event type for any event emitted by this toolkit.
class EventSlot(widget, event, funcs=())

Bases: object

Event slots object. Allows dynamic allocation of events. Args:

widget: The widget you want to bind this event slot to.
event: str The attribute you want to bind to (e.g. ‘on_click’).
funcs: A sequence of functions you want to include by default.

Add additional functions to be called.

func: A function or sequence of functions to be added.

Remove functions from the existing set of functions.

func: A function or sequence of functions to be removed.

surface Module

Screen class to store rect information with the screen and setup the toolkit.

class Screen(size, flags=0, depth=0)

Bases: object

Class for the screen.

This must be used instead of pygame.display.set_mode().

image: The pygame.display screen.
rect: pygame.Rect containing screen size.
size, flags, depth: Arguments for pygame.display.set_mode()

Table Of Contents

Previous topic


Next topic

widgets Package