phoenix_title wx.lib.agw.piectrl

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

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 Panel or similar. ProgressPie tries to emulate the behavior of ProgressDialog, but using a pie chart instead of a gauge.

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.SetValue(300)
        part.SetColour(wx.Colour(200, 50, 50))
        mypie._series.append(part)

        part = PC.PiePart()

        part.SetLabel("Label 2")
        part.SetValue(200)
        part.SetColour(wx.Colour(50, 200, 50))
        mypie._series.append(part)

        part = PC.PiePart()

        part.SetLabel("helloworld label 3")
        part.SetValue(50)
        part.SetColour(wx.Colour(50, 50, 200))
        mypie._series.append(part)

        # 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.RED)
        progress_pie.SetUnfilledColour(wx.WHITE)
        progress_pie.SetHeight(20)

        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)

        panel.SetSizer(main_sizer)
        main_sizer.Layout()


# our normal wxApp-derived class, as usual

app = wx.App(0)

frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()

app.MainLoop()

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.

Window Styles

No particular window styles are available for this class.

Events Processing

No custom events are available for this class.

License And Version

PieCtrl is distributed under the wxPython license.

Latest revision: Andrea Gavana @ 16 Jul 2012, 15.00 GMT

Version 0.3

class_summary Classes Summary

PieCtrl

PieCtrl is somewhat a “static” control, that you may create in order to display

PieCtrlLegend

This class displays a legend window for the classic PieCtrl.

PiePart

This class handles the legend segments properties, such as value,

ProgressPie

ProgressPie tries to emulate the behavior of ProgressDialog, but