diff options
Diffstat (limited to 'ext/tk/sample/demos-en/label.rb')
-rw-r--r-- | ext/tk/sample/demos-en/label.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/tk/sample/demos-en/label.rb b/ext/tk/sample/demos-en/label.rb index 55e07a5ebc..91e41e4a22 100644 --- a/ext/tk/sample/demos-en/label.rb +++ b/ext/tk/sample/demos-en/label.rb @@ -19,8 +19,10 @@ $label_demo = TkToplevel.new {|w| positionWindow(w) } +base_frame = TkFrame.new($label_demo).pack(:fill=>:both, :expand=>true) + # label -msg = TkLabel.new($label_demo) { +msg = TkLabel.new(base_frame) { font $font wraplength '4i' justify 'left' @@ -29,7 +31,7 @@ msg = TkLabel.new($label_demo) { msg.pack('side'=>'top') # frame -TkFrame.new($label_demo) {|frame| +TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' command proc{ @@ -47,8 +49,8 @@ TkFrame.new($label_demo) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # label demo -f_left = TkFrame.new($label_demo) -f_right = TkFrame.new($label_demo) +f_left = TkFrame.new(base_frame) +f_right = TkFrame.new(base_frame) [f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} @@ -59,7 +61,8 @@ f_right = TkFrame.new($label_demo) TkLabel.new(f_left, 'text'=>'Third label, sunken', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} -TkLabel.new(f_right) { +# TkLabel.new(f_right) { +Tk::Label.new(f_right) { bitmap('@' + [$demo_dir,'..','images','face.xbm'].join(File::Separator)) borderwidth 2 relief 'sunken' |