summaryrefslogtreecommitdiff
path: root/ext/tk/sample/demos-en/twind.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/demos-en/twind.rb')
-rw-r--r--ext/tk/sample/demos-en/twind.rb60
1 files changed, 30 insertions, 30 deletions
diff --git a/ext/tk/sample/demos-en/twind.rb b/ext/tk/sample/demos-en/twind.rb
index 65ee712ff7..60a345d0b4 100644
--- a/ext/tk/sample/demos-en/twind.rb
+++ b/ext/tk/sample/demos-en/twind.rb
@@ -8,7 +8,7 @@
# toplevel widget
if defined?($twind_demo) && $twind_demo
- $twind_demo.destroy
+ $twind_demo.destroy
$twind_demo = nil
end
@@ -41,10 +41,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# frame
$twind_text = nil
-TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
+TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
'relief'=>'sunken') {|f|
- $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font,
- 'width'=>'70', 'height'=>35, 'wrap'=>'word',
+ $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font,
+ 'width'=>'70', 'height'=>35, 'wrap'=>'word',
'highlightthickness'=>0, 'borderwidth'=>0 ){|t|
TkScrollbar.new(f) {|s|
command proc{|*args| t.yview(*args)}
@@ -53,12 +53,12 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2,
}.pack('expand'=>'yes', 'fill'=>'both')
}.pack('expand'=>'yes', 'fill'=>'both')
-#
-$tag_center = TkTextTag.new($twind_text,
+#
+$tag_center = TkTextTag.new($twind_text,
'justify' =>'center',
'spacing1'=>'5m',
'spacing3'=>'5m' )
-$tag_buttons = TkTextTag.new($twind_text,
+$tag_buttons = TkTextTag.new($twind_text,
'lmargin1'=>'1c',
'lmargin2'=>'1c',
'rmargin' =>'1c',
@@ -71,7 +71,7 @@ $twind_text.insert('end', "it. These are called \"embedded windows\", ")
$twind_text.insert('end', "and they can consist of arbitrary widgets. ")
$twind_text.insert('end', "For example, here are two embedded button ")
$twind_text.insert('end', "widgets. You can click on the first button to ")
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
#text 'ON'
text 'Turn On'
@@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end',
$twind_text.insert('end', " horizontal scrolling, which also turns off ")
$twind_text.insert('end', "word wrapping. Or, you can click on the second ")
$twind_text.insert('end', "button to\n")
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
#text 'OFF'
text 'Turn Off'
@@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end',
$twind_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n")
$twind_text.insert('end', "Or, here is another example. If you ")
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
text 'Click Here'
command proc{textWindPlot $twind_text}
@@ -102,7 +102,7 @@ $mark_plot = TkTextMark.new($twind_text, 'insert')
$mark_plot.gravity='left'
$twind_text.insert('end', " You can drag the data points around with the mouse, ")
$twind_text.insert('end', "or you can click here to ")
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
text 'Delete'
command proc{textWindDel $twind_text}
@@ -124,7 +124,7 @@ $twind_text.insert('end', "changes the layout. Click on the button again ")
$twind_text.insert('end', "to restore the short string.\n")
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {|b|
text 'Default'
command proc{embDefBg $twind_text}
@@ -133,7 +133,7 @@ TkTextWindow.new($twind_text, 'end',
},
'padx'=>3 )
embToggle = TkVariable.new('Short')
-TkTextWindow.new($twind_text, 'end',
+TkTextWindow.new($twind_text, 'end',
'window'=>TkCheckButton.new($twind_text) {
textvariable embToggle
indicatoron 0
@@ -144,25 +144,25 @@ TkTextWindow.new($twind_text, 'end',
pady 5
padx 2
},
- 'padx'=>3,
+ 'padx'=>3,
'pady'=>2 )
-[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4',
- 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1',
- 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1',
- 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4'
+[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4',
+ 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1',
+ 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1',
+ 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4'
].each{|twind_color|
- TkTextWindow.new($twind_text, 'end',
+ TkTextWindow.new($twind_text, 'end',
'window'=>TkButton.new($twind_text) {
text twind_color
cursor 'top_left_arrow'
command proc{$twind_text.bg twind_color}
},
- 'padx'=>3,
+ 'padx'=>3,
'pady'=>2 )
}
-#
+#
def textWindOn (w,f)
if defined? $twind_scroll
begin
@@ -216,39 +216,39 @@ def textWindPlot (t)
TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2)
TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2)
- TkcText.new($twind_plot, 225, 20,
+ TkcText.new($twind_plot, 225, 20,
'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown')
(0..10).each {|i|
x = 100 + (i * 30)
TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2)
- TkcText.new($twind_plot, x, 254,
+ TkcText.new($twind_plot, x, 254,
'text'=>10*i, 'font'=>font, 'anchor'=>'n')
}
(0..5).each {|i|
y = 250 - (i * 40)
TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2)
- TkcText.new($twind_plot, 96, y,
+ TkcText.new($twind_plot, 96, y,
'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e')
}
for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]]
x = 100 + (3*xx)
y = 250 - (4*yy)/5
- item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6,
+ item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6,
'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2')
item.addtag 'point'
end
- $twind_plot.itembind('point', 'Any-Enter',
+ $twind_plot.itembind('point', 'Any-Enter',
proc{$twind_plot.itemconfigure 'current', 'fill', 'red'})
- $twind_plot.itembind('point', 'Any-Leave',
+ $twind_plot.itembind('point', 'Any-Leave',
proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'})
- $twind_plot.itembind('point', '1',
+ $twind_plot.itembind('point', '1',
proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y")
- $twind_plot.itembind('point', 'ButtonRelease-1',
+ $twind_plot.itembind('point', 'ButtonRelease-1',
proc{$twind_plot.dtag 'selected'})
- $twind_plot.bind('B1-Motion',
+ $twind_plot.bind('B1-Motion',
proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y")
while ($twind_text.get($mark_plot) =~ /[ \t\n]/)
$twind_text.delete $mark_plot