Module: FFI::Tk

Extended by:
Library
Defined in:
lib/ffi-tk/ffi/tk.rb,
lib/ffi-tk/version.rb

Defined Under Namespace

Classes: Window, XColor

Constant Summary collapse

VERSION =
"2018.02.20"

Class Method Summary collapse

Class Method Details

.get_color(interp, string) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/ffi-tk/ffi/tk.rb', line 41

def get_color(interp, string)
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
  else
    Tcl.thread_sender.thread_send do
      XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
    end
  end
end

.init(interp) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ffi-tk/ffi/tk.rb', line 59

def init(interp)
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    if Tk_Init(interp) == 1
      message = Tcl.Tcl_GetStringResult(interp)
      raise message
    end
  else
    Tcl.thread_sender.thread_send do
      if Tk_Init(interp) == 1
        message = Tcl.Tcl_GetStringResult(interp)
        raise message
      end
    end
  end
end

.mainloopObject



51
52
53
54
55
56
57
# File 'lib/ffi-tk/ffi/tk.rb', line 51

def mainloop
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    Tk_MainLoop()
  else
    Tcl.thread_sender.thread_send { Tk_MainLoop() }
  end
end