Class: Dictionaries::GUI::Tk::Dictionary

Inherits:
TkFrame
  • Object
show all
Includes:
Colours::E
Defined in:
lib/dictionaries/gui/tk/dictionary.rb

Overview

< Base === Dictionaries::GUI::Tk::Dictionary.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(i = nil, run_already = true) ⇒ Dictionary

#

initialize

#


30
31
32
33
34
35
36
37
38
39
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 30

def initialize(
    i           = nil,
    run_already = true
  )
  super()
  reset
  set_input(i)
  title "TK wrapper for the Dictionaries project"
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

Dictionaries::GUI:Tk::Dictionary[]

#


76
77
78
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 76

def self.[](i = '')
  self.new(i)
end

Instance Method Details

#input?Boolean

#

input?

#

Returns:

  • (Boolean)


59
60
61
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 59

def input?
  @input
end

#resetObject

#

reset (reset tag)

#


44
45
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 44

def reset
end

#runObject

#

run (run tag)

#


66
67
68
69
70
71
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 66

def run
  TkLabel.new(root) do
   text 'Hello, World!'
   pack { padx 15 ; pady 15; side 'left' }
  end
end

#set_input(i = '') ⇒ Object

#

set_input

#


50
51
52
53
54
# File 'lib/dictionaries/gui/tk/dictionary.rb', line 50

def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  @input = i
end