tk_paradise 0.0.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of tk_paradise might be problematic. Click here for more details.

Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/doc/HINTS.md +318 -0
  3. data/lib/tk_paradise/base/base.rb +63 -0
  4. data/lib/tk_paradise/examples/001_dialog_box_example.rb +21 -0
  5. data/lib/tk_paradise/examples/002_draw_tiny_box.rb +22 -0
  6. data/lib/tk_paradise/examples/003_fun_with_cursors.rb +82 -0
  7. data/lib/tk_paradise/examples/004_hello_world_example.rb +22 -0
  8. data/lib/tk_paradise/examples/005_key_press_event_example.rb +21 -0
  9. data/lib/tk_paradise/examples/006_multiple_buttons.rb +16 -0
  10. data/lib/tk_paradise/examples/007_packing_example_in_tk.rb +28 -0
  11. data/lib/tk_paradise/examples/008_pig_latin_example.rb +70 -0
  12. data/lib/tk_paradise/examples/009_scrollbar_example.rb +44 -0
  13. data/lib/tk_paradise/examples/010_telnet_client.rb +106 -0
  14. data/lib/tk_paradise/examples/011_thermostat_example.rb +60 -0
  15. data/lib/tk_paradise/examples/012_tk_menu_example.rb +23 -0
  16. data/lib/tk_paradise/examples/013_tk_popup.rb +61 -0
  17. data/lib/tk_paradise/examples/014_tk_slider.rb +63 -0
  18. data/lib/tk_paradise/examples/015_choose_colour_example.rb +22 -0
  19. data/lib/tk_paradise/examples/016_spin_box_example.rb +28 -0
  20. data/lib/tk_paradise/examples/017_combo_box_example.rb +46 -0
  21. data/lib/tk_paradise/examples/018_tk_list_box_example.rb +18 -0
  22. data/lib/tk_paradise/examples/advanced/0001_example_showing_move_method.rb +32 -0
  23. data/lib/tk_paradise/tk_classes/root.rb +24 -0
  24. data/lib/tk_paradise/tk_paradise.rb +164 -0
  25. data/lib/tk_paradise/version/version.rb +19 -0
  26. data/lib/tk_paradise.rb +5 -0
  27. data/tk_paradise.gemspec +41 -0
  28. metadata +102 -0
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'tk'
6
+
7
+ # =========================================================================== #
8
+ # Demonstrates adding a vertical row of buttons to a scrolling canvas.
9
+ # =========================================================================== #
10
+ Tk.root.title('Test')
11
+ Tk.root.geometry('800x600+0+0')
12
+
13
+ canvas = TkCanvas.new(Tk.root) {
14
+ width 320
15
+ height 200
16
+ scrollregion '0 0 400 400'
17
+ pack(side: :left, fill: :both, expand: :true )
18
+ }
19
+
20
+ # =========================================================================== #
21
+ # Create the scrollbar next:
22
+ # =========================================================================== #
23
+ vbar = TkScrollbar.new(Tk.root) {
24
+ orient 'vert'
25
+ pack(side: :right, fill: :y)
26
+ }
27
+
28
+ canvas.yscrollbar(vbar)
29
+
30
+ frame = TkFrame.new(canvas) { |entry|
31
+ (1 .. 12).each { |i|
32
+ TkButton.new(entry) {
33
+ text i
34
+ command { Tk.bell }
35
+ grid
36
+ }
37
+ }
38
+ }
39
+
40
+ TkcLine.new(canvas, 0, 0, 400, 400)
41
+ TkcLine.new(canvas, 0, 400, 400, 0)
42
+ TkcWindow.new(canvas, 200, 200, width: 100, height: 280, window: frame)
43
+
44
+ Tk.mainloop
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require "tk"
6
+
7
+ def packing(padx, pady, side = "left", anchor = "n")
8
+ { padx: padx, pady: pady, side: side, anchor: anchor }
9
+ end
10
+
11
+ root = TkRoot.new() { title "Telnet session" }
12
+ top = TkFrame.new(root)
13
+ fr1 = TkFrame.new(top)
14
+ fr1a = TkFrame.new(fr1)
15
+ fr1b = TkFrame.new(fr1)
16
+ fr2 = TkFrame.new(top)
17
+ fr3 = TkFrame.new(top)
18
+ fr4 = TkFrame.new(top)
19
+
20
+ LabelPack = packing(5, 5, "top", "w")
21
+ EntryPack = packing(5, 2, "top")
22
+ ButtonPack = packing(15, 5, "left", "center")
23
+ FramePack = packing(2, 2, "top")
24
+ Frame1Pack = packing(2, 2, "left")
25
+
26
+ var_host = TkVariable.new
27
+ var_port = TkVariable.new
28
+ var_user = TkVariable.new
29
+ var_pass = TkVariable.new
30
+
31
+ lab_host = TkLabel.new(fr1a) do
32
+ text "Host name"
33
+ pack LabelPack
34
+ end
35
+
36
+ ent_host = TkEntry.new(fr1a) do
37
+ textvariable var_host
38
+ font "{Helvetica} 10"
39
+ pack EntryPack
40
+ end
41
+
42
+ lab_port = TkLabel.new(fr1b) do
43
+ text "Port"
44
+ pack LabelPack
45
+ end
46
+
47
+ ent_port = TkEntry.new(fr1b) do
48
+ width 4
49
+ textvariable var_port
50
+ font "{Helvetica} 10"
51
+ pack EntryPack
52
+ end
53
+
54
+ lab_user = TkLabel.new(fr2) do
55
+ text "User name"
56
+ pack LabelPack
57
+ end
58
+
59
+ ent_user = TkEntry.new(fr2) do
60
+ width 21
61
+ font "{Helvetica} 12"
62
+ textvariable var_user
63
+ pack EntryPack
64
+ end
65
+
66
+ lab_pass = TkLabel.new(fr3) do
67
+ text "Password"
68
+ pack LabelPack
69
+ end
70
+
71
+ ent_pass = TkEntry.new(fr3) do
72
+ width 21
73
+ show "*"
74
+ textvariable var_pass
75
+ font "{Helvetica} 12"
76
+ pack EntryPack
77
+ end
78
+
79
+ btn_signon = TkButton.new(fr4) do
80
+ text "Sign on"
81
+ command {} # Does nothing!
82
+ pack ButtonPack
83
+ end
84
+
85
+ btn_cancel = TkButton.new(fr4) do
86
+ text "Cancel"
87
+ command { exit } # Just exits
88
+ pack ButtonPack
89
+ end
90
+
91
+ top.pack FramePack
92
+ fr1.pack FramePack
93
+ fr2.pack FramePack
94
+ fr3.pack FramePack
95
+ fr4.pack FramePack
96
+ fr1a.pack Frame1Pack
97
+ fr1b.pack Frame1Pack
98
+
99
+ var_host.value = "addison-wesley.com"
100
+ var_user.value = "debra"
101
+ var_port.value = 23
102
+
103
+ ent_pass.focus
104
+ foo = ent_user.font
105
+
106
+ Tk.mainloop
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+
6
+
7
+ require 'tk'
8
+
9
+ # Common packing options...
10
+ top = { side: 'top', padx: 5, pady: 5 }
11
+ left = { side: 'left', padx: 5, pady: 5 }
12
+ bottom = { side: 'bottom', padx: 5, pady: 5 }
13
+
14
+ # Starting temperature...
15
+ temp = 74
16
+
17
+ root = TkRoot.new { title "Thermostat" }
18
+ tframe = TkFrame.new(root) { background "#606060" }
19
+ bframe = TkFrame.new(root)
20
+
21
+ tlab = TkLabel.new(tframe) do
22
+ text temp.to_s
23
+ font "{Helvetica} 54 {bold}"
24
+ foreground "green"
25
+ background "#606060"
26
+ pack left
27
+ end
28
+
29
+ # the "degree" symbol
30
+ TkLabel.new(tframe) do
31
+ text "o"
32
+ font "{Helvetica} 14 {bold}"
33
+ foreground "green"
34
+ background "#606060"
35
+ # Anchor-north above text like a degree symbol
36
+ pack left.update(anchor: 'n')
37
+ end
38
+
39
+ TkButton.new(bframe) do
40
+ text " Up "
41
+ pack left
42
+ command {
43
+ temp += 1
44
+ tlab.configure(text: temp.to_s)
45
+ }
46
+ end
47
+
48
+ TkButton.new(bframe) do
49
+ text "Down"
50
+ pack left
51
+ command {
52
+ temp -= 1
53
+ tlab.configure(text: temp.to_s)
54
+ }
55
+ end
56
+
57
+ tframe.pack top
58
+ bframe.pack bottom
59
+
60
+ Tk.mainloop
@@ -0,0 +1,23 @@
1
+ require 'tk'
2
+
3
+
4
+
5
+ root = TkRoot.new() { title "Ruby/Tk Menu Example" }
6
+
7
+ bar = TkMenu.new()
8
+
9
+ sys = TkMenu.new(bar)
10
+ sys.add('command', 'label'=>"Quit", 'command'=>proc { root.destroy })
11
+ bar.add('cascade', 'menu'=>sys, 'label'=>"System")
12
+
13
+ file = TkMenu.new(bar)
14
+ file.add('command', 'label'=>"Open", 'command'=>proc { puts "Open..." })
15
+ file.add('command', 'label'=>"Close", 'command'=>proc { puts "Close..." })
16
+ bar.add('cascade', 'menu'=>file, 'label'=>"File")
17
+
18
+ root.menu(bar)
19
+
20
+
21
+ Tk.mainloop()
22
+
23
+
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # tkpopup.rb : wrapper for tk_popup
6
+ # by Masahiro SATO (m@sa.to)
7
+ # Time-stamp: <99/08/14 10:49:28 msato>
8
+ # =========================================================================== #
9
+ require 'tk'
10
+
11
+ class TkPopup < TkWindow
12
+
13
+ # ========================================================================= #
14
+ # === initialize
15
+ # ========================================================================= #
16
+ def initialize(menu, x = 0, y = 0, entry = '')
17
+ super()
18
+ @menu = menu
19
+ @x = x
20
+ @y = y
21
+ @entry = entry
22
+ INTERP._eval('tk_popup '+
23
+ [@menu.path, @x.to_s, @y.to_s, @entry.to_s].join(' '))
24
+ end
25
+ end
26
+
27
+ ######################################################################
28
+ # example
29
+ # You will see a popup menu by clicking Button-3
30
+ ######################################################################
31
+ if __FILE__ == $0
32
+ color_ar = %w( blue yellow green pink grey )
33
+ color = color_ar[0]
34
+
35
+ TkRoot.new {|r|
36
+ title File.basename($0)
37
+ button = TkButton.new(r,
38
+ 'text' => 'Quit',
39
+ "background" => color,
40
+ "activebackground" => "light " + color,
41
+ "command" => proc {r.destroy}
42
+ ).pack "fill"=>"both", "expand"=>"yes"
43
+
44
+ menu = TkMenu.new(button, 'tearoff' => false)
45
+ color_ar.each {|col|
46
+ menu.add("command",
47
+ "label" => col,
48
+ "command" => proc {
49
+ color = col
50
+ button.background color
51
+ button.activebackground 'light '+color
52
+ }
53
+ )
54
+ }
55
+
56
+ button.bind("Button-3", proc {|x, y|
57
+ TkPopup.new(menu, x, y, color_ar.index(color))
58
+ }, "%X %Y") # x_root and y_root
59
+ }
60
+ Tk.mainloop
61
+ end
@@ -0,0 +1,63 @@
1
+ # This demonstration script creates a text widget that illustrates the
2
+ # various display styles that may be set for tags.
3
+ # Modified from the demo widget example provided in the Tcl release
4
+ require 'tk'
5
+ TITLE = 'Packing Example'
6
+ root = TkRoot.new() { title TITLE }
7
+ button = TkButton.new(root) {
8
+ text "First, rightmost"
9
+ }
10
+ button.pack("side"=>"right", "fill"=>'y')
11
+ entry = TkEntry.new(root).pack("side"=>"top", "fill"=>"x")
12
+ entry.insert(0, "Entry on the top")
13
+ label = TkLabel.new() { text 'to the right' }
14
+ label.pack("side"=>"right")
15
+ image = TkPhotoImage.new(
16
+ 'file' => '/home/x/DATA/images/NJOY/Leeann_Tweeden.png',
17
+ 'height' => 52
18
+ )
19
+ img_label = TkLabel.new(root) { image image }.pack("anchor"=>"e")
20
+ text = TkText.new(root) { width 20; height 5 }.pack("side"=>"left")
21
+ text.insert('end', "Left in canvas")
22
+ TkButton.new(root) {
23
+ index = 0
24
+ text 'Click Me'
25
+ command proc {
26
+ index += 1
27
+ puts 'Congratulations on creating ' +
28
+ 'your '+verbose_number_to_word_position(index.to_s)+' Ruby/Tk' +
29
+ 'application'}
30
+ }.pack('padx'=>15, 'pady'=>15)
31
+ #TkScrollbar.new(root)
32
+ TkMessage.new(root) { text "Message in the Bottom" }.pack("side"=>"bottom")
33
+ Tk.mainloop()
34
+
35
+
36
+ #text .t -yscrollcommand ".scroll set" -setgrid true \
37
+ # -width 40 -height 10 -wrap word
38
+ #scrollbar .scroll -command ".t yview"
39
+ #pack .scroll -side right -fill y
40
+ #pack .t -expand yes -fill both
41
+ #
42
+ # Set up the tags
43
+ #.t tag configure bold_italics -font \
44
+ # {-family courier -size 12 -weight bold -slant italic}
45
+ #.t tag configure big -font {-family helvetica -size 24 -weight bold}
46
+ #.t tag configure color1 -foreground red
47
+ #.t tag configure sunken -relief sunken -borderwidth 1
48
+ #.t tag bind Ouch <1> {.t insert end "Ouch! "}
49
+ #
50
+ # Now insert text that has the property of the tags
51
+ #.t insert end "Here are a few text styles.\n"
52
+ #.t insert end "1. Bold italic text.\n" bold_italics#
53
+ #.t insert end "2. Larger Helvetica text.\n" big
54
+ #.t insert end "3. Red text.\n" color1
55
+ #.t insert end "4. Sunken text.\n" sunken
56
+ #button .b -text "5. An embedded Hello Button" \
57
+ # -command {.t insert end "Hello "}
58
+ #.t window create end -window .b
59
+ #.t insert end "\n"
60
+ # .t insert end "6. Text with a binding (try clicking me)" Ouch
61
+ #.t insert end "\nAnd all this is editable!"
62
+
63
+
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'tk'
6
+
7
+ root = TkRoot.new
8
+ root.title = 'Window'
9
+ root.geometry('800x600+0+0')
10
+
11
+ button_click = Proc.new {
12
+ Tk.chooseColor
13
+ }
14
+
15
+ button = TkButton.new(root) {
16
+ text 'button'
17
+ pack(side: :left, padx: "50", pady: "50")
18
+ }
19
+
20
+ button.command = button_click
21
+
22
+ Tk.mainloop
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'tk'
6
+
7
+ alias e puts
8
+
9
+ root = TkRoot.new
10
+ root.title = 'Window'
11
+ root.geometry('800x600+0+0')
12
+
13
+ @spin_box_variable = TkVariable.new
14
+ @spin_box = TkSpinbox.new(root) {
15
+ from 0
16
+ to 100
17
+ increment 5
18
+ justify :center
19
+ textvariable @spin_box_variable
20
+ command proc { callback }
21
+ pack(side: 'left', padx: '50', pady: '50')
22
+ }
23
+ def callback
24
+ e 'The value has changed.'
25
+ e @spin_box_variable.get
26
+ end
27
+
28
+ Tk.mainloop
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'tk'
6
+
7
+ alias e puts
8
+
9
+ root = TkRoot.new
10
+ root.title = 'Combo Box Example'
11
+ root.geometry('700x550+0+0')
12
+
13
+ MONOSPACED_FONT = TkFont.new(family: 'Hack', size: 22, weight: 'bold')
14
+
15
+ # =========================================================================== #
16
+ # label text for title
17
+ # =========================================================================== #
18
+ TkLabel.new(root,
19
+ text: 'Combobox Widget',
20
+ background: 'green',
21
+ foreground: 'white',
22
+ font: MONOSPACED_FONT
23
+ ).grid(row: 0, column: 0)
24
+
25
+ TkLabel.new(root,
26
+ text: 'Select the month:',
27
+ font: MONOSPACED_FONT
28
+ ).grid(column: 0, row: 5, padx: 10, pady: 25)
29
+
30
+ # =========================================================================== #
31
+ # Combobox creation:
32
+ # =========================================================================== #
33
+ n = TkVariable.new
34
+ combo_box = TkCombobox.new(
35
+ root,
36
+ width: 30,
37
+ font: MONOSPACED_FONT,
38
+ textvariable: n
39
+ )
40
+ combo_box.values(%w(
41
+ aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu
42
+ ))
43
+ combo_box.grid(column: 0, row: 6)
44
+ combo_box.current = 3
45
+
46
+ Tk.mainloop
@@ -0,0 +1,18 @@
1
+ require 'tk'
2
+
3
+ root = TkRoot.new
4
+ root.title = "Window"
5
+ root.geometry('700x400+0+0')
6
+ list = TkListbox.new(root) {
7
+ width 10
8
+ height 10
9
+ setgrid 1
10
+ selectmode 'multiple'
11
+ pack('fill' => 'x')
12
+ }
13
+
14
+ list.insert 0, "yellow", "gray", "green",
15
+ "blue", "red", "black", "white", "cyan",
16
+ "pink", "yellow", "orange", "gray"
17
+
18
+ Tk.mainloop
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'tk_paradise'
6
+
7
+ alias e puts
8
+
9
+ @window = Tk.root
10
+ @window.title = 'Window'
11
+ @window.move(0, 0)
12
+ USE_THIS_FONT = TkFont.new(family: 'Helvetica', size: 20, weight: 'bold')
13
+
14
+ # =========================================================================== #
15
+ # === on_button1_clicked
16
+ # =========================================================================== #
17
+ def on_button1_clicked
18
+ result = Tk.choose_colour # The result may be like this: "#d9845b"
19
+ @window.configure(background: result)
20
+ return result
21
+ end
22
+
23
+ proc_on_button_clicked = Proc.new { on_button1_clicked }
24
+
25
+ button = TkButton.new(@window) {
26
+ text 'button: choose a colour'
27
+ font USE_THIS_FONT
28
+ pack(side: :left, padx: "50", pady: "50")
29
+ }
30
+ button.command = proc_on_button_clicked
31
+
32
+ Tk.run
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'tk_paradise/tk_classes/root.rb'
6
+ # =========================================================================== #
7
+ module Tk
8
+
9
+ class Root
10
+
11
+ # ========================================================================= #
12
+ # === move
13
+ #
14
+ # This will re-position the tk-root widget to the specified position,
15
+ # similar to how ruby-gtk works.
16
+ # ========================================================================= #
17
+ def move(
18
+ x = 0,
19
+ y = 0
20
+ )
21
+ root.geometry("+#{x}+#{y}") # This will only specify the x and y coordinates
22
+ end
23
+
24
+ end; end
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'tk_paradise/tk_paradise.rb'
6
+ # include Tk
7
+ # =========================================================================== #
8
+ require 'tk'
9
+
10
+ module Tk
11
+
12
+ alias choose_colour chooseColor # === choose_colour
13
+
14
+ # ========================================================================= #
15
+ # Provide some "aliases".
16
+ # ========================================================================= #
17
+ Grid = TkGrid
18
+ Font = TkFont
19
+ # ========================================================================= #
20
+ # Button = TkButton
21
+ # Note that the tk-gem already defines Button.
22
+ # ========================================================================= #
23
+
24
+ # ========================================================================= #
25
+ # === e
26
+ # ========================================================================= #
27
+ def e(i = '')
28
+ puts i
29
+ end
30
+
31
+ # ========================================================================= #
32
+ # === Tk.run
33
+ # ========================================================================= #
34
+ def self.run
35
+ ::Tk.mainloop
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === Tk.root
40
+ # ========================================================================= #
41
+ def self.root(hash = {}, &block)
42
+ root = TkRoot.new { hash }
43
+ if block_given?
44
+ yielded = yield
45
+ if yielded.is_a? Hash
46
+ # =================================================================== #
47
+ # === :geometry
48
+ # =================================================================== #
49
+ if yielded.has_key? :geometry
50
+ root.geometry(yielded[:geometry])
51
+ end
52
+ # =================================================================== #
53
+ # === :title
54
+ # =================================================================== #
55
+ if yielded.has_key? :title
56
+ root.title = yielded[:title]
57
+ end
58
+ end
59
+ end
60
+ return root
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === tk_label
65
+ #
66
+ # The second argument should be the root-widget.
67
+ #
68
+ # Usage example:
69
+ #
70
+ # tk_label('Message in the Bottom', root) { :on_bottom }
71
+ #
72
+ # ========================================================================= #
73
+ def tk_label(
74
+ text_to_use = '',
75
+ root_widget = nil,
76
+ font = nil # fontStyle = tkFont.Font(family="Lucida Grande", size=20)
77
+ )
78
+ pack_onto_this_side = 'bottom'
79
+ # ======================================================================= #
80
+ # === Handle blocks next
81
+ # ======================================================================= #
82
+ if block_given?
83
+ yielded = yield
84
+ case yielded # case tag
85
+ # ===================================================================== #
86
+ # === :on_bottom
87
+ # ===================================================================== #
88
+ when :on_bottom
89
+ pack_onto_this_side = 'bottom'
90
+ # ===================================================================== #
91
+ # === :on_right
92
+ # ===================================================================== #
93
+ when :on_right
94
+ pack_onto_this_side = 'right'
95
+ end
96
+ end
97
+ ::TkMessage.new(root_widget) {
98
+ text(text_to_use)
99
+ }.pack('side' => pack_onto_this_side)
100
+ end; alias label tk_label # === label
101
+
102
+ # ========================================================================= #
103
+ # === tk_image
104
+ #
105
+ # Usage examples:
106
+ #
107
+ # - create an empty image of 300x200 pixels:
108
+ #
109
+ # image = TkPhotoImage.new(height: 200, width: 300)
110
+ #
111
+ # - create an image from a file:
112
+ #
113
+ # image = TkPhotoImage.new(file: 'my_image.gif')
114
+ #
115
+ # ========================================================================= #
116
+ def tk_image(
117
+ path_to_the_image,
118
+ extra_arguments = { height: 50 }
119
+ )
120
+ hash = {}
121
+ hash['file'] = path_to_the_image
122
+ hash.merge(extra_arguments)
123
+ return ::TkPhotoImage.new(hash)
124
+ end; alias image tk_image # === image
125
+
126
+ # ========================================================================= #
127
+ # === tk_button
128
+ # ========================================================================= #
129
+ # def tk_button
130
+ # end; alias button tk_button # === button
131
+
132
+ class Button
133
+
134
+ # ======================================================================= #
135
+ # === set_font
136
+ # ======================================================================= #
137
+ def set_font(i)
138
+ self['font'] = i
139
+ end
140
+
141
+ end
142
+
143
+ class TkLabel
144
+
145
+ # ======================================================================= #
146
+ # === set_text
147
+ # ======================================================================= #
148
+ def set_text(i)
149
+ configure(text: i)
150
+ end
151
+
152
+ end
153
+
154
+ # create button
155
+ # button = Button(gui, text='My Button', bg='#0052cc', fg='#ffffff')
156
+ # # apply font to the button label
157
+ # button['font'] = myFont
158
+
159
+ end
160
+
161
+ # =========================================================================== #
162
+ # Next, require some addons - modifications of core-tk classes.
163
+ # =========================================================================== #
164
+ require 'tk_paradise/tk_classes/root.rb'