File: wx.lib.agw.piectrl.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (168 lines) | stat: -rw-r--r-- 5,036 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.agw.piectrl

.. currentmodule:: wx.lib.agw.piectrl

.. highlight:: python



.. _wx.lib.agw.piectrl:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.piectrl**
==========================================================================================================================================

:class:`~wx.lib.agw.piectrl.PieCtrl` and :class:`~wx.lib.agw.piectrl.ProgressPie` are simple classes that reproduce the behavior of a pie
chart.


Description
===========

:class:`PieCtrl` and :class:`ProgressPie` are simple classes that reproduce the behavior of a pie
chart. They use only pure wxPython classes/methods, without external dependencies.
:class:`PieCtrl` is somewhat a "static" control, that you may create in order to display
a simple pie chart on a :class:`Panel` or similar. :class:`ProgressPie` tries to emulate the
behavior of :class:`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.Colour(255, 0, 0))
            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 :class:`PieCtrl` you can:

- Create a :class:`PieCtrl` with different sectors;
- Set the sector values, colours and labels;
- Assign a legend to the :class:`PieCtrl`;
- Use an image as the :class:`PieCtrl` background;
- Change the vertical rotation (perspective) of the :class:`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
===================

:class:`PieCtrl` is distributed under the wxPython license.

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

Version 0.3


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.agw.piectrl.PieCtrl`                                               :class:`PieCtrl` is somewhat a "static" control, that you may create in order to display
:ref:`~wx.lib.agw.piectrl.PieCtrlLegend`                                         This class displays a legend window for the classic :class:`PieCtrl`.
:ref:`~wx.lib.agw.piectrl.PiePart`                                               This class handles the legend segments properties, such as value,
:ref:`~wx.lib.agw.piectrl.ProgressPie`                                           :class:`ProgressPie` tries to emulate the behavior of :class:`ProgressDialog`, but
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.agw.piectrl.PieCtrl
   wx.lib.agw.piectrl.PieCtrlLegend
   wx.lib.agw.piectrl.PiePart
   wx.lib.agw.piectrl.ProgressPie