3
// "$Id: browser.py 241 2006-07-24 11:00:42Z andreasheld $"
5
// Browser test program for pyFLTK the Python bindings
6
// for the Fast Light Tool Kit (FLTK).
8
// Copyright 1998-1999 by Bill Spitzak and others.
9
// pyFLTK copyright 2003 by Andreas Held and others.
11
// This library is free software you can redistribute it and/or
12
// modify it under the terms of the GNU Library General Public
13
// License as published by the Free Software Foundation either
14
// version 2 of the License, or (at your option) any later version.
16
// This library is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
// Library General Public License for more details.
21
// You should have received a copy of the GNU Library General Public
22
// License along with this library if not, write to the Free Software
23
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26
# Please report all bugs and problems to "pyfltk-user@lists.sourceforge.net".
30
This is a test of how the browser draws lines.
31
This is a second line.
34
That was a blank line above this.
46
@f@i@bBold Italic Fixed
52
@s@i@bSmall italic bold
58
You should try different browser types:
70
#print "callback, selection = %d, event_clicks = <not yet wrapped>"%(ptr.value())
71
print "callback, selection = %d, event_clicks = %d"%(ptr.value(),Fl.event_clicks())
74
if field.value() == '':
75
fl_alert("Please enter a number in the text field\n"
76
"before clicking on the buttons.")
78
line = int(field.value())
79
if str(ptr) == str(top):
81
elif str(ptr) == str(bottom):
82
browser.bottomline(line)
83
elif str(ptr) == str(middle):
84
browser.middleline(line)
86
browser.make_visible(line)
88
# if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help)
91
window = Fl_Window(400,400,fname)
92
#window.box(FL_NO_BOX) # because it is filled with browser
94
browser = Fl_Select_Browser(0,0,400,350,"")
96
browser.type(FL_MULTI_BROWSER)
98
browser.callback(b_cb)
99
print "Browser font = ", browser.textfont()
100
print "Setting browser font to Courier"
101
browser.textfont(FL_COURIER)
102
print "Browser font size = ", browser.textsize()
103
print "Setting browser font size to 11"
105
print "Browser font color = ", browser.textcolor()
106
print "Setting browser font color to red"
107
browser.textcolor(FL_RED)
109
browser.scrollbar_right()
110
browser.has_scrollbar(Fl_Browser.BOTH_ALWAYS)
112
if not browser.load(fname):
113
print "Can't load " + fname
118
#print browser.value()
121
field = Fl_Int_Input(50,350,350,25,"Line #:")
122
field.callback(show_cb)
124
top = Fl_Button(0,375,100,25,"Top")
125
top.callback(show_cb)
127
bottom = Fl_Button(100, 375, 100, 25, "Bottom")
128
bottom.callback(show_cb);
130
middle = Fl_Button(200, 375, 100, 25, "Middle")
131
middle.callback(show_cb);
133
visible = Fl_Button(300, 375, 100, 25, "Make Vis.")
134
visible.callback(show_cb);
138
window.resizable(browser)
139
window.show(len(sys.argv), sys.argv)