1# 2# "$Id: adjuster.py 35 2003-09-29 21:39:48Z andreasheld $" 3# 4# Adjuster 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 as published by the Free Software Foundation either 13# version 2 of the License, or (at your option) any later version. 14# 15# This library is distributed in the hope that it will be useful, 16# but WITHOUT ANY WARRANTY without even the implied warranty of 17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18# Library General Public License for more details. 19# 20# You should have received a copy of the GNU Library General Public 21# License along with this library if not, write to the Free Software 22# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23# USA. 24# 25# Please report all bugs and problems to "pyfltk-user@lists.sourceforge.net". 26# 27 28from fltk import * 29import sys 30import time 31 32label = "" 33 34def adjcb(ptr, widget): 35 global label # need to keep this global to avoid garbage collection 36 label = widget.label() 37 ret,label = ptr.format(label) 38 widget.label(label) 39 widget.redraw() 40 return None 41 42window = Fl_Window(320,100) 43buf1 = '0.0000' 44b1 = Fl_Box(FL_DOWN_BOX,20,30,80,25,buf1) 45b1.color(FL_WHITE) 46a1 = Fl_Adjuster(20+80,30,3*25,25) 47a1.callback(adjcb,b1) 48 49buf2 = '0.0000' 50b2 = Fl_Box(FL_DOWN_BOX,20+80+4*25,30,80,25,buf2) 51b2.color(FL_WHITE) 52a2 = Fl_Adjuster(b2.x()+b2.w(),10,25,3*25) 53a2.callback(adjcb,b2) 54 55window.resizable(window) 56window.end() 57window.show() 58 59Fl.run() 60