| 1 | # |
| 2 | # "$Id: iconize.py 35 2003-09-29 21:39:48Z andreasheld $" |
| 3 | # |
| 4 | # Iconize 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 | |
| 31 | def iconize_cb(ptr, win): |
| 32 | win.iconize() |
| 33 | |
| 34 | def show_cb(ptr, win): |
| 35 | win.show() |
| 36 | |
| 37 | def hide_cb(ptr, win): |
| 38 | win.hide() |
| 39 | |
| 40 | def window_cb(ptr): |
| 41 | sys.exit(0) |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | mainw = Fl_Window(200,200) |
| 47 | mainw.end() |
| 48 | mainw.show(len(sys.argv),sys.argv) |
| 49 | |
| 50 | control = Fl_Window(120,120) |
| 51 | |
| 52 | hide_button = Fl_Button(0,0,120,30,"hide()") |
| 53 | hide_button.callback(hide_cb, mainw); |
| 54 | |
| 55 | iconize_button = Fl_Button(0,30,120,30,"iconize()") |
| 56 | iconize_button.callback(iconize_cb, mainw) |
| 57 | |
| 58 | show_button = Fl_Button(0,60,120,30,"show()") |
| 59 | show_button.callback(show_cb, mainw) |
| 60 | |
| 61 | show_button2 = Fl_Button(0,90,120,30,"show this") |
| 62 | show_button2.callback(show_cb, control) |
| 63 | |
| 64 | # Fl_Box box(FL_NO_BOX,0,60,120,30,"Also try running\nwith -i switch"); |
| 65 | |
| 66 | control.end() |
| 67 | control.show() |
| 68 | control.callback(window_cb) |
| 69 | |
| 70 | Fl.run() |