1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# -*- coding: utf-8 -*-
#
# entry (no scrollbars) widget demo (called by 'widget')
#
# toplevel widget ãåå¨ããã°åé¤ãã
if defined?($entry1_demo) && $entry1_demo
$entry1_demo.destroy
$entry1_demo = nil
end
# demo ç¨ã® toplevel widget ãçæ
$entry1_demo = TkToplevel.new {|w|
title("Entry Demonstration (no scrollbars)")
iconname("entry1")
positionWindow(w)
}
base_frame = TkFrame.new($entry1_demo).pack(:fill=>:both, :expand=>true)
# label çæ
msg = TkLabel.new(base_frame) {
font $font
wraplength '5i'
justify 'left'
text "3種é¡ã®ç°ãªãã¨ã³ããªã表示ããã¦ãã¾ããæåãå
¥åããã«ã¯ãã¤ã³ã¿ãæã£ã¦è¡ããã¯ãªãã¯ãã¦ããã¿ã¤ããã¦ãã ãããæ¨æºçãªMotifã®ç·¨éæ©è½ããEmacsã®ãã¼ãã¤ã³ãã¨ã¨ãã«ããµãã¼ãããã¦ãã¾ããä¾ãã°ãããã¯ã¹ãã¼ã¹ã¨ã³ã³ããã¼ã«-Hã¯ã«ã¼ã½ã«ã®å·¦ã®æåãåé¤ããããªã¼ããã¼ã¨ã³ã³ããã¼ã«-Dã¯ã«ã¼ã½ã«ã®å³å´ã®æåãåé¤ãã¾ããé·éãã¦ã¦ã£ã³ãã¦ã«å
¥ãåããªããã®ã¯ããã¦ã¹ã®ãã¿ã³2ãæ¼ããã¾ã¾ãã©ãã°ãããã¨ã§ã¹ã¯ãã¼ã«ããããã¨ãã§ãã¾ããæ¥æ¬èªãå
¥åããã®ã¯ã³ã³ããã¼ã«-ããã¯ã¹ã©ãã·ã¥ã§ããkinput2ãåãã¦ããã°å
¥åãããã¨ãã§ãã¾ãã"
}
msg.pack('side'=>'top')
# frame çæ
TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
#text 'äºè§£'
text 'éãã'
command proc{
tmppath = $entry1_demo
$entry1_demo = nil
tmppath.destroy
}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text 'ã³ã¼ãåç
§'
command proc{showCode 'entry1'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# entry çæ
e1 = TkEntry.new(base_frame, 'relief'=>'sunken')
e2 = TkEntry.new(base_frame, 'relief'=>'sunken')
e3 = TkEntry.new(base_frame, 'relief'=>'sunken')
[e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')}
# åæå¤æ¿å
¥
e1.insert(0, 'åæå¤')
e2.insert('end', "ãã®ã¨ã³ããªã«ã¯é·ãæååãå
¥ã£ã¦ãã¦ã")
e2.insert('end', "é·ããã¦ã¦ã£ã³ãã¦ã«ã¯å
¥ãåããªãã®ã§ã")
e2.insert('end', "å®éã®æçµãã¾ã§è¦ãã«ã¯ã¹ã¯ãã¼ã«ãããªããã°")
e2.insert('end', "ãªããªãã§ãããã")
|