Fl_Pack example code:
from fltk import *
#packs
def but_cb(wid):
wid.color(FL_GREEN)
win = Fl_Window(0,0,400, 400, "Fl_Pack")
win.begin()
p=Fl_Pack(0,0, 400, 300)
p.type(Fl_Pack.HORIZONTAL)
p.begin()
bl=[]
for x in range(3):
bl.append(Fl_Button(0, 0, p.w()//3 , 0, str(x+1)))
bl[-1].callback(but_cb)
p.end()
p.resizable(bl[0]) # set resizable arg as either 1)widget 2)Group itself 3)None
p2= Fl_Pack(0, 300,400, 100)
p2.type(Fl_Pack.VERTICAL)
p2.begin()
b1=Fl_Button(0,0, 0, p2.h()//2,'A')
b2=Fl_Button(0,0, 0, p2.h()//2,'B')
p2.end()
p2.resizable(b1)
win.end()
win.resizable(p)
win.show()
Fl.run()
Fl_Scroll example code:
from fltk import *
#scroll
def but_cb(wid):
wid.color(FL_GREEN)
win = Fl_Window(0,0,400, 400, "Fl_Scroll")
win.begin()
s=Fl_Scroll(0,0, 400, 300)
s.type(Fl_Scroll.HORIZONTAL)
s.begin()
bl=[]
for x in range(9):
bl.append(Fl_Button(x*40, 0, 40 , 280, str(x+1)))
bl[-1].callback(but_cb)
s.end()
s.resizable(s)
s2= Fl_Scroll(0, 300,400, 100)
s2.begin()
sl=[]
for x in range(20):
sl.append(Fl_Button(0, x*30+300, 380 , 30, str(x+1)))
sl[-1].callback(but_cb)
s2.end()
s2.resizable(s2)
s2.type(Fl_Scroll.VERTICAL)
win.end()
win.resizable(win)
win.show()
Fl.run()