2
# "$Id: chart.py 28 2003-07-16 20:00:27Z andreasheld $"
4
# Charts test program for pyFLTK the Python bindings
5
# for the Fast Light Tool Kit (FLTK).
7
# FLTK copyright 1998-1999 by Bill Spitzak and others.
8
# pyFLTK copyright 2003 by Andreas Held and others.
10
# This library is free software you can redistribute it and/or
11
# modify it under the terms of the GNU Library General Public
12
# License as published by the Free Software Foundation either
13
# version 2 of the License, or (at your option) any later version.
15
# This library is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
# Library General Public License for more details.
20
# You should have received a copy of the GNU Library General Public
21
# License along with this library if not, write to the Free Software
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25
# Please report all bugs and problems to "pyfltk-user@lists.sourceforge.net".
31
# Note: the child windows are assigned to the charts list
32
# for the program to exit correctly, the Python shadows
33
# must be deleted. this is accomplished by the charts=None
34
# in the exit function
39
charts = None ### <- this allows the program to exit
52
# ugly, hacked coordinates
54
x2 = (border*2)+graphWidth
55
x3 = (border+graphWidth)*2+border
57
y2 = border*2+graphHeight
58
y3 = border*3+graphHeight*2
60
(FL_BAR_CHART,"FL_BAR_CHART", x1, y1),
61
(FL_HORBAR_CHART,"FL_HORBAR_CHART", x2, y1),
62
(FL_LINE_CHART,"FL_LINE_CHART", x3, y1),
63
(FL_SPIKE_CHART,"FL_SPIKE_CHART", x1, y2),
64
(FL_PIE_CHART,"FL_PIE_CHART", x2, y2),
65
(FL_SPECIALPIE_CHART,"FL_SPECIALPIE_CHART", x3, y2),
66
(FL_FILL_CHART,"FL_FILL_CHART", x1, y3) ]
69
foo_window = Fl_Window(100, 100, border+numCols*(border+graphWidth),
70
numRows*(border+graphHeight)+border+buttonHeight+border)
72
for chartParams in chartInfo:
73
chart = Fl_Chart(chartParams[2], chartParams[3],
74
graphWidth, graphHeight, chartParams[1])
75
chart.type(chartParams[0])
76
chart.add(2, "Win 3.1", 0)
77
chart.add(3, "Dos", 1)
79
chart.add(10, "Linux", 2)
82
okButton = Fl_Return_Button( (numCols-1)*(graphWidth+border),
83
numRows*(graphHeight+border)+border, buttonWidth, buttonHeight, "OK")
84
okButton.callback(cb_OK)
87
foo_window.show(len(sys.argv), sys.argv)