2
# "$Id: arc.py 111 2005-08-22 14:14:49Z andreasheld $"
4
# Arc drawing program for pyFLTK the Python bindings
5
# for the Fast Light Tool Kit (FLTK).
6
# Illustrates the use of the Fl_Widget base class.
8
# FLTK copyright 1998-1999 by Bill Spitzak and others.
9
# pyFLTK copyright 2003 by Andreas Held and others.
11
# This library is free software you can redistribute it and/or
12
# modify it under the terms of the GNU Library General Public
13
# License as published by the Free Software Foundation either
14
# version 2 of the License, or (at your option) any later version.
16
# This library is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
# Library General Public License for more details.
21
# You should have received a copy of the GNU Library General Public
22
# License along with this library if not, write to the Free Software
23
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26
# Please report all bugs and problems to "pyfltk-user@lists.sourceforge.net".
29
# Arc drawing test program for the Fast Light Tool Kit (FLTK).
34
args = [140, 140, 50, 0, 360, 0]
35
name = ["X", "Y", "R", "start", "end", "rotate"]
38
class Drawing(Fl_Widget):
40
def __init__(self, X, Y, W, H, L):
41
Fl_Widget.__init__(self, X, Y, W, H, L)
50
fl_push_clip(xpos,ypos,w,h)
52
fl_rectf(xpos,ypos,w,h)
55
fl_translate(xpos+w/2.0, ypos+h/2.0)
57
fl_translate(-(xpos+w/2.0), -(ypos+h/2.0))
59
fl_translate(xpos,ypos)
60
fl_begin_complex_polygon()
61
fl_arc(args[0],args[1],args[2],args[3],args[4])
63
fl_arc(140,140,20,0,-360)
64
fl_end_complex_polygon()
67
fl_arc(args[0],args[1],args[2],args[3],args[4])
72
print 'uncaught!', sys.exc_type, sys.exc_value
77
def slider_cb(ptr, v):
79
args[long(v)] = ptr.value()
84
window = Fl_Window(300,500)
85
d = Drawing(10,10,280,280, "test")
88
s = [None,None,None,None,None,None]
90
s[n] = Fl_Hor_Value_Slider(50,y,240,25,name[n])
104
s[n].align(FL_ALIGN_LEFT)
105
s[n].callback(slider_cb, n)
110
#window.show(len(sys.argv),sys.argv)
112
window.show(sys.argv)