Debian Codegraph @

fltk/test/pack.py

raw symbols SCIP
1 #
2 # "$Id: pack.py 495 2013-03-30 09:39:45Z andreasheld $"
3 #
4 # Pack test program for pyFLTK the Python bindings
5 # for the Fast Light Tool Kit (FLTK).
6 #
7 # FLTK copyright 1998-1999 by Bill Spitzak and others.
8 # pyFLTK copyright 2003 by Andreas Held and others.
9 #
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, version 2.0 as published by the Free Software Foundation.
13 #
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Library General Public License for more details.
18 #
19 # You should have received a copy of the GNU Library General Public
20 # License along with this library if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 # USA.
23 #
24 # Please report all bugs and problems to "[email protected]".
25 #
26
27 from fltk import *
28 import sys
29
30 w = Fl_Window(100, 100, 365, 525)
31
32 scroll = Fl_Scroll(10,10,345,285)
33
34 pack = Fl_Pack(10, 10, 345, 285)
35 pack.box(FL_DOWN_FRAME)
36
37
38 def type_cbH(ptr):
39 type_cb(Fl_Pack.HORIZONTAL)
40
41 def type_cbV(ptr):
42 type_cb(Fl_Pack.VERTICAL)
43
44 def type_cb(v):
45 for i in range(0,pack.children(),1):
46 pack.child(i).resize(0,0,25,25)
47 pack.resize(scroll.x(), scroll.y(), scroll.w(), scroll.h())
48 p = pack.parent()
49 p.redraw()
50 pack.type(v)
51 pack.redraw()
52
53 def spacing_cb(ptr):
54 pack.spacing(int(valueSlider.value()))
55 scroll.redraw()
56
57 buttons=[]
58 buttons.append( Fl_Button(35, 35, 25, 25, "b1"))
59 buttons.append( Fl_Button(45, 45, 25, 25, "b2"))
60 buttons.append( Fl_Button(55, 55, 25, 25, "b3"))
61 buttons.append( Fl_Button(65, 65, 25, 25, "b4"))
62 buttons.append( Fl_Button(75, 75, 25, 25, "b5"))
63 buttons.append( Fl_Button(85, 85, 25, 25, "b6"))
64 buttons.append( Fl_Button(95, 95, 25, 25, "b7"))
65 buttons.append( Fl_Button(105, 105, 25, 25, "b8"))
66 buttons.append( Fl_Button(115, 115, 25, 25, "b9"))
67 buttons.append( Fl_Button(125, 125, 25, 25, "b10"))
68 buttons.append( Fl_Button(135, 135, 25, 25, "b11"))
69 buttons.append( Fl_Button(145, 145, 25, 25, "b12"))
70 buttons.append( Fl_Button(155, 155, 25, 25, "b13"))
71 buttons.append( Fl_Button(165, 165, 25, 25, "b14"))
72 buttons.append( Fl_Button(175, 175, 25, 25, "b15"))
73 buttons.append( Fl_Button(185, 185, 25, 25, "b16"))
74 buttons.append( Fl_Button(195, 195, 25, 25, "b17"))
75 buttons.append( Fl_Button(205, 205, 25, 25, "b18"))
76 buttons.append( Fl_Button(215, 215, 25, 25, "b19"))
77 buttons.append( Fl_Button(225, 225, 25, 25, "b20"))
78 buttons.append( Fl_Button(235, 235, 25, 25, "b21"))
79 buttons.append( Fl_Button(245, 245, 25, 25, "b22"))
80 buttons.append( Fl_Button(255, 255, 25, 25, "b23"))
81 buttons.append( Fl_Button(265, 265, 25, 25, "b24"))
82 w.end()
83 w.resizable(pack)
84
85 scroll.end()
86 o = ( Fl_Light_Button(10, 325, 175, 25, "VERTICAL"))
87 buttons.append(o)
88 o.type(FL_RADIO_BUTTON)
89 o.callback(type_cbH)
90
91 o = ( Fl_Light_Button(10, 350, 175, 25, "HORIZONTAL"))
92 buttons.append( o )
93 o.type(FL_RADIO_BUTTON)
94 o.value(1)
95 o.callback(type_cbV)
96
97 o = ( Fl_Value_Slider(50,375, 295,25,"spacing:"))
98 valueSlider = o
99 buttons.append( o )
100 o.align(FL_ALIGN_LEFT)
101 o.type(FL_HORIZONTAL)
102 o.range(0,30)
103 o.step(1)
104 o.callback(spacing_cb)
105
106 w.end()
107 w.show(len(sys.argv), sys.argv)
108 Fl.run()
109
110