Skip to content

Albow Python 3

Humberto A Sanchez II edited this page May 4, 2019 · 12 revisions

Welcome to the Albow-Python-3 Wiki!


This is a framework for creating a GUI using PyGame. It was developed for use in PyWeek competition entries, and has been used by the author in several games so far.
  • Version 1.1 introduced a theme system to provide a central place for customising the appearance of Albow widgets, so you can easily give each of your games a distinctive look.
  • Version 2.0 adds a number of substantial new features, including TabPanel and TableView widgets and improved TextField-based controls.
  • Version 2.1 adds drop-down and pop-up menus, music facilities and OpenGL capabilities.
  • Version 2.2 adds Multichoice controls and a number of other improvements.
  • Version 2.3 is a complete by Humberto A. Sanchez II to make this project work in Python 3. Additionally, it beefs up the documentation, the demonstration program, as well as a major internal refactoring for future maintainability
  • Version 2.3.5 introduced a new minimal ListBox widget based on the PaletteView

Usage

Typical usage of the widget system is as follows:
  1. Initialize the PyGame display surface.
  2. Create an instance of RootWidget or subclass thereof (such as Shell), passing it the display surface.
  3. Create additional widgets if needed and add them as subwidgets of the root widget. If using Shell, create the screens you will be using and display your main screen.
  4. Start the frame timer if you will be using it (see RootWidget.set_timer()).
  5. Call the run() method of the root widget.

Constructors

There is a convention used by the constructors of Widget and its subclasses. As well as the arguments listed in the documentation for the class's constructor, you can also pass initial values for any other attributes of the class as keyword arguments.

You can do this for attributes of your own Widget subclasses as well, if you pass on any extra keyword arguments to the base class init method. The only requirement is that the attribute already exist as an instance or class attribute, or as a property. This ensures that mistaken keyword arguments are diagnosed rather than silently creating a new attribute.

Themes

Themes provide a centralized way of customizing the appearance of Albow widgets on a per-class basis. There are three parts to the theme system: theme properties, which are attributes that get looked up automatically in the currently active themes; the Theme class, instances of which hold values for the theme properties of a articular class; and the theme module, which holds a default hierarchy of Theme instances that your application can replace. See the documentation pages on each of these for more details.
Clone this wiki locally