Debian Codegraph @

fltk/test/window.py

raw symbols SCIP
1 # window test program for pyFLTK the Python bindings
2 # for the Fast Light Tool Kit (FLTK).
3 #
4 # FLTK copyright 1998-1999 by Bill Spitzak and others.
5 # pyFLTK copyright 2003 by Andreas Held and others.
6 #
7 # This library is free software you can redistribute it and/or
8 # modify it under the terms of the GNU Library General Public
9 # License, version 2.0 as published by the Free Software Foundation.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
15 #
16 # You should have received a copy of the GNU Library General Public
17 # License along with this library if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 # USA.
20 #
21 # Please report all bugs and problems to "[email protected]".
22 #
23
24
25 from fltk import *
26 import time, string
27
28 window = None
29 fullscreen = 0
30 label = ""
31
32 def cb(ptr, data):
33 print(data)
34
35 def full_cb(ptr):
36 "toggle fullscreen"
37 global fullscreen
38 if fullscreen == 0:
39 fullscreen = 1
40 window.fullscreen()
41 else:
42 fullscreen = 0
43 window.fullscreen_off(100,100,300,300)
44
45 def resize_cb(ptr, data):
46 "grow/shrink the window"
47 window.resize(window.x(), window.y(), window.w()+10*data,
48 window.h()+10*data)
49
50 def iconize_cb(ptr):
51 "iconize the window"
52 window.iconize()
53
54 def hotspot_cb(ptr):
55 "move the window to the hotspot"
56 window.hotspot(10,10)
57
58 def label_cb(ptr):
59 "change the label of the window, variable label must be global"
60 global label
61 label = "Another "+window.label()
62 window.label(label)
63
64 window = Fl_Window(300,300)
65 window.label("Window Test")
66
67 window.size_range(100,100,500,500,10,10,1)
68
69 b1 = Fl_Button(10,10,80,25,"Fullscreen")
70 b1.callback(full_cb)
71
72 b2 = Fl_Button(100,10,80,25,"Grow")
73 b2.callback(resize_cb, 1)
74
75 b3 = Fl_Button(190,10,80,25,"Shrink")
76 b3.callback(resize_cb, -1)
77
78 b4 = Fl_Button(10,45,80,25,"Iconize")
79 b4.callback(iconize_cb)
80
81 b5 = Fl_Button(100,45,80,25,"Hotspot")
82 b5.callback(hotspot_cb)
83
84 b6 = Fl_Button(100,45,80,25,"Label")
85 b6.callback(label_cb)
86
87 window.show()
88
89 window.hotspot(100,100)
90
91 Fl.run()