| 1 | # |
| 2 | # "$Id: widgets.py 28 2003-07-16 20:00:27Z andreasheld $" |
| 3 | # |
| 4 | # Widgets 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 | window = None |
| 31 | |
| 32 | def theExitCallback(ptr): |
| 33 | import sys |
| 34 | sys.exit(0) |
| 35 | |
| 36 | data = [ "@c Hello there.", |
| 37 | "This is a demo of some of the widgets pyFLTK can do", |
| 38 | "@s Unfortunately, that's about all it does...", |
| 39 | "@b Because now the darn font attributes work differently" |
| 40 | ] |
| 41 | |
| 42 | window = Fl_Window(100, 100, 400, 200, "widgets.py") |
| 43 | |
| 44 | browser = Fl_Browser(10, 10, 380, 100) |
| 45 | for line in data: |
| 46 | browser.add(line) |
| 47 | |
| 48 | browser.data(3, "Fortunately") |
| 49 | #print browser.get_data(3) |
| 50 | |
| 51 | slider = Fl_Hor_Value_Slider(10, 120, 180, 15) |
| 52 | |
| 53 | button = Fl_Button(200, 120, 190, 15, "Exit") |
| 54 | button.callback(theExitCallback) |
| 55 | |
| 56 | output = Fl_Output(10, 150, 380, 20) |
| 57 | output.value("Label's don't work either. Need to typemap some more.") |
| 58 | |
| 59 | window.end() |
| 60 | #window.resizable(window.this) |
| 61 | window.show() |
| 62 | |
| 63 | Fl.run() |