| 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 |
from fltk import * |
| 28 |
import sys |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
charts =[] |
| 35 |
|
| 36 |
def cb_OK(ptr): |
| 37 |
global charts |
| 38 |
charts = None |
| 39 |
sys.exit(0) |
| 40 |
|
| 41 |
|
| 42 |
graphWidth = 150 |
| 43 |
graphHeight = 100 |
| 44 |
border = 30 |
| 45 |
numRows = 3 |
| 46 |
numCols = 3 |
| 47 |
buttonWidth = 60 |
| 48 |
buttonHeight = 30 |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
x1 = border |
| 53 |
x2 = (border*2)+graphWidth |
| 54 |
x3 = (border+graphWidth)*2+border |
| 55 |
y1 = border |
| 56 |
y2 = border*2+graphHeight |
| 57 |
y3 = border*3+graphHeight*2 |
| 58 |
chartInfo = [ \ |
| 59 |
(FL_BAR_CHART,"FL_BAR_CHART", x1, y1), |
| 60 |
(FL_HORBAR_CHART,"FL_HORBAR_CHART", x2, y1), |
| 61 |
(FL_LINE_CHART,"FL_LINE_CHART", x3, y1), |
| 62 |
(FL_SPIKE_CHART,"FL_SPIKE_CHART", x1, y2), |
| 63 |
(FL_PIE_CHART,"FL_PIE_CHART", x2, y2), |
| 64 |
(FL_SPECIALPIE_CHART,"FL_SPECIALPIE_CHART", x3, y2), |
| 65 |
(FL_FILL_CHART,"FL_FILL_CHART", x1, y3) ] |
| 66 |
|
| 67 |
|
| 68 |
foo_window = Fl_Window(100, 100, border+numCols*(border+graphWidth), |
| 69 |
numRows*(border+graphHeight)+border+buttonHeight+border) |
| 70 |
|
| 71 |
for chartParams in chartInfo: |
| 72 |
chart = Fl_Chart(chartParams[2], chartParams[3], |
| 73 |
graphWidth, graphHeight, chartParams[1]) |
| 74 |
chart.type(chartParams[0]) |
| 75 |
chart.add(2, "Win 3.1", 0) |
| 76 |
chart.add(3, "Dos", 1) |
| 77 |
chart.add(5, "NT", 3) |
| 78 |
chart.add(10, "Linux", 2) |
| 79 |
charts.append(chart) |
| 80 |
|
| 81 |
okButton = Fl_Return_Button( (numCols-1)*(graphWidth+border), |
| 82 |
numRows*(graphHeight+border)+border, buttonWidth, buttonHeight, "OK") |
| 83 |
okButton.callback(cb_OK) |
| 84 |
|
| 85 |
foo_window.end() |
| 86 |
foo_window.show(len(sys.argv), sys.argv) |
| 87 |
|
| 88 |
Fl.run() |
| 89 |
|