1#!/usr/bin/env ruby
2require 'tk'
3require 'tkextlib/iwidgets'
4
5# Create the tabnotebook widget and pack it.
6tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
7tn.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"
12tn.add(:label=>'Page One')
13tn.add(:label=>'Page Two')
14
15# Get the child site frames of these two pages.
16page1CS = tn.child_site(0)
17page2CS = tn.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.
24tn.select(0)
25
26Tk.mainloop
27