Debian Codegraph @

fltk/test/group.py

raw symbols SCIP
1 #
2 # "$Id: group.py 495 2013-03-30 09:39:45Z andreasheld $"
3 #
4 # Group 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 removed = 0
31 window = None
32 grp = None
33 btn = None
34
35
36 def btn_cb(ptr):
37 global window
38 global grp
39 global removed
40 if removed == 0:
41 print("removing button")
42 grp.remove(btn)
43 removed = 1
44 else:
45 print("adding button")
46 grp.add(btn)
47 removed = 0
48 window.redraw()
49
50 window = Fl_Window(320,130)
51
52 grp = Fl_Group(10, 10, 300,110)
53 b1 = Fl_Button(10, 10, 130, 30, "Add/Remove")
54 b1.tooltip("Pressing this button should remove the second button, pressing it again should add the other button.")
55 b1.callback(btn_cb)
56 grp.end()
57 window.end()
58 removed = 1
59 btn = Fl_Return_Button(150, 10, 160, 30, "Fl_Return_Button")
60
61 window.show(len(sys.argv), sys.argv)
62 Fl.run()
63