~ubuntu-branches/ubuntu/intrepid/ruby1.8/intrepid-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

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