Debian Codegraph @

fltk/test/wizard.py

raw symbols SCIP
1 #
2 # "$Id: wizard.py 28 2003-07-16 20:00:27Z andreasheld $"
3 #
4 # Wizard 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
28 from fltk import *
29
30
31 class Panel(Fl_Group):
32 def __init__(self, X, Y, W, H, C, T):
33 Fl_Group.__init__(self, X, Y, W, H, T)
34 Fl_Group.align(self, FL_ALIGN_INSIDE | FL_ALIGN_CENTER)
35 Fl_Group.box(self, FL_ENGRAVED_BOX)
36 self.labelcolor(C)
37 self.labelsize(20)
38 self.end()
39
40
41 class Wizard(Fl_Wizard):
42 def __init__(self, X, Y, W, H, T):
43 Fl_Wizard.__init__(self, X, Y, W, H, T)
44 self.p1 = Panel(X,Y,W,H, FL_RED, "Panel 1")
45 self.p2 = Panel(X,Y,W,H, FL_MAGENTA, "Panel 2")
46 self.p3 = Panel(X,Y,W,H, FL_BLUE, "Panel 3")
47 self.value(self.p1)
48
49 def next_callback(self, widget):
50 if self.value() == self.p3:
51 self.value(self.p1)
52 else:
53 self.next()
54
55 def prev_callback(self, widget):
56 if self.value() == self.p1:
57 self.value(self.p3)
58 else:
59 self.prev()
60
61
62 if __name__=='__main__':
63 window = Fl_Window(300, 165, "Fl_Wizard test")
64 wizard = Wizard(5, 5, 290, 100, "")
65 wizard.end()
66
67 buttons = Fl_Group(5, 110, 290, 50)
68 buttons.box(FL_ENGRAVED_BOX)
69 prev_button = Fl_Button( 15, 120, 110, 30, "@< Prev Panel")
70 prev_button.callback(wizard.prev_callback)
71 prev_button.align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER | FL_ALIGN_LEFT)
72 next_button = Fl_Button(175, 120, 110, 30, "Next Panel @>")
73 next_button.align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER | FL_ALIGN_RIGHT)
74 next_button.callback(wizard.next_callback)
75 buttons.end()
76 window.end()
77 window.show()
78 Fl.run()