AGW Logo

agw_title piectrl

PieCtrl and ProgressPie are simple classes that reproduce the behavior of a pie chart.

description Description

PieCtrl and ProgressPie are simple classes that reproduce the behavior of a pie chart. They use only pure wxPython classes/methods, without external dependencies. PieCtrl is somewhat a “static” control, that you may create in order to display a simple pie chart on a wx.Panel or similar. ProgressPie tries to emulate the behavior of wx.ProgressDialog, but using a pie chart instead of a gauge.

usage Usage

Usage example:

import wx
import wx.lib.agw.piectrl as PC

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "PieCtrl Demo")

        panel = wx.Panel(self)

        # create a simple PieCtrl with 3 sectors
        mypie = PC.PieCtrl(panel, -1, wx.DefaultPosition, wx.Size(180,270))

        part = PC.PiePart()

        part.SetLabel("Label 1")
        part.SetColour(wx.Colour(200, 50, 50))

        part = PC.PiePart()

        part.SetLabel("Label 2")
        part.SetColour(wx.Colour(50, 200, 50))

        part = PC.PiePart()

        part.SetLabel("helloworld label 3")
        part.SetColour(wx.Colour(50, 50, 200))

        # create a ProgressPie
        progress_pie = PC.ProgressPie(panel, 100, 50, -1, wx.DefaultPosition,
                                      wx.Size(180, 200), wx.SIMPLE_BORDER)

        progress_pie.SetBackColour(wx.Colour(150, 200, 255))
        progress_pie.SetFilledcolour(wx.Colour(255, 0, 0))

        main_sizer = wx.BoxSizer(wx.HORIZONTAL)

        main_sizer.Add(mypie, 1, wx.EXPAND | wx.ALL, 5)
        main_sizer.Add(progress_pie, 1, wx.EXPAND | wx.ALL, 5)


# our normal wxApp-derived class, as usual

app = wx.PySimpleApp()

frame = MyFrame(None)


This code snippet can be downloaded, see this example script.


Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.

settings Methods and Settings

With PieCtrl you can:

  • Create a PieCtrl with different sectors;
  • Set the sector values, colours and labels;
  • Assign a legend to the PieCtrl;
  • Use an image as the PieCtrl background;
  • Change the vertical rotation (perspective) of the PieCtrl;
  • Show/hide the segment edges.

styles Window Styles

No particular window styles are available for this class.

events Events Processing

No custom events are available for this class.

license License And Version

PieCtrl is distributed under the wxPython license.

Latest revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT

Version 0.2

Module author: Andrea Gavana <>

hierarchy Inheritance Diagram

Inheritance diagram for module: piectrl

Inheritance diagram of piectrl.PieCtrl, piectrl.PieCtrlLegend, piectrl.PiePart, piectrl.ProgressPie

svn_main SVN Revisions

A graphical representation of the SVN commits in the last year.

Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.


Revision Graph For piectrl

2to3 Python 3 Issues (via 2to3)

No issues have been detected by