1#!/usr/bin/env ruby
2require 'tk'
3require 'tkextlib/iwidgets'
4
5# Create the tabnotebook widget and pack it.
6nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
7nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
8        :side=>:left, :padx=>10, :pady=>10)
9
10# Add two pages to the tabnotebook,
11# labelled "Page One" and "Page Two"
12nb.add(:label=>'Page One')
13nb.add(:label=>'Page Two')
14
15# Get the child site frames of these two pages.
16page1CS = nb.child_site(0)
17page2CS = nb.child_site('Page Two')
18
19# Create buttons on each page of the tabnotebook.
20TkButton.new(page1CS, :text=>'Button One').pack
21TkButton.new(page2CS, :text=>'Button Two').pack
22
23# Select the first page of the tabnotebook.
24nb.select(0)
25
26# Create the scrollbar and associate the scrollbar
27# and the notebook together, then pack the scrollbar
28nb.scrollbar(TkScrollbar.new).pack(:fill=>:y, :expand=>true, :pady=>10)
29
30Tk.mainloop
31