Debian Codegraph @

fltk/test/exceptions.py

raw symbols SCIP
1 # "$Id: demos.py 531 2019-12-27 12:15:45Z andreasheld $"
2 #
3 # Test program for pyFLTK the Python bindings
4 # for the Fast Light Tool Kit (FLTK).
5 #
6 # FLTK copyright 1998-1999 by Bill Spitzak and others.
7 # pyFLTK copyright 2003 by Andreas Held and others.
8 #
9 # This library is free software you can redistribute it and/or
10 # modify it under the terms of the GNU Library General Public
11 # License, version 2.0 as published by the Free Software Foundation.
12 #
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Library General Public License for more details.
17 #
18 # You should have received a copy of the GNU Library General Public
19 # License along with this library if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 # USA.
22 #
23 # Please report all bugs and problems to "[email protected]".
24 #
25
26
27 from fltk import *
28
29 class subwindow(Fl_Gl_Window):
30
31 def __init__(self, x,y,w,h):
32 super().__init__(x,y,w,h, "")
33
34 def handle(self, event):
35 if event == FL_PUSH:
36 raise Exception("exception in handle")
37 return super().handle(event)
38
39 def draw(self):
40 pass
41
42
43
44 class MyButton(Fl_Button):
45 def __init__(self, x,y,w,h, l):
46 super().__init__(x,y,w,h, l)
47 self.callback(self.b_cb)
48
49 def b_cb(self, wid):
50 raise Exception("exception in callback")
51
52 if __name__=='__main__':
53 window = Fl_Double_Window(0, 0, 500, 500, "tst")
54
55 widget = subwindow(0,0,500,400)
56 window.resizable(widget)
57
58 mb = MyButton(200,420,100,60, "Exit")
59
60
61 try:
62 window.end()
63 window.show()
64 Fl.run()
65 except Exception as e:
66 print("Exception: ", e)
67