manveru / ffi-tk

FFI bindings to the Tk GUI toolkit

This URL has Read+Write access

ffi-tk /
name age message
file .gitignore Tue Jan 05 19:57:38 -0800 2010 Adding .gitignore [manveru]
file AUTHORS Fri Jan 01 23:39:12 -0800 2010 Version 2010.01.02 [manveru]
file CHANGELOG Fri Jan 01 23:39:12 -0800 2010 Version 2010.01.02 [manveru]
file MANIFEST Fri Jan 01 23:39:12 -0800 2010 Version 2010.01.02 [manveru]
file README.md Fri Dec 18 05:44:35 -0800 2009 Update readme [manveru]
file Rakefile Fri Jan 01 23:39:12 -0800 2010 Version 2010.01.02 [manveru]
file TODO.md Tue Nov 17 01:10:22 -0800 2009 Update TODO [manveru]
directory bin/ Thu Nov 05 02:14:59 -0800 2009 Add bin/rwish not very functional yet [manveru]
directory doc/ Sat Oct 31 03:27:34 -0700 2009 Add README and licenses [manveru]
directory example/ Sat Dec 05 08:50:39 -0800 2009 Gnugo defaults to 19 size [manveru]
file ffi-tk.gemspec Fri Jan 01 23:39:12 -0800 2010 Version 2010.01.02 [manveru]
directory lib/ Tue Jan 05 09:33:31 -0800 2010 Add FFI::Tk::get_color [manveru]
directory spec/ Mon Nov 23 08:13:47 -0800 2009 Fix Listbox#value [lian]
directory tasks/ Fri Nov 06 10:14:27 -0800 2009 Adding Rakefile and tasks [manveru]
README.md

FFI::Tk

This library provides you with a wrapper for the Tk windowing toolkit.

Installation

gem install ffi-tk

No compilation is required, but I'm not yet confident that this will run on every architecture without changes, FFI::Tk is being developed on Archlinux and Debian on Intel i686 and AMD x86_64, testers for other platforms are invited to give it a try and report any problems that occur.

You will need to have tk installed in order to actually use the library.

Ruby-FFI

Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code.

It lives at: http://wiki.github.com/ffi/ffi

Ruby-FFI ships with JRuby and Rubinius, and is available as a gem for MRI.

Hello, World!

require 'ffi-tk'

Tk.init

Tk::Button.new('.', text: 'Press me'){
  Tk::MessageBox.new(message: 'Hello, World!')
}.pack

Tk.mainloop

Aims and Means

First of all, FFI::Tk doesn't try to be a drop-in replacement for the tk library of Ruby's stdlib.

We will try to keep things as simple as possible, and there will not be 10 different ways to achieve the same thing through numerous aliases.

We will not rely on any compiled extensions and the only dependency is FFI to keep things portable between different Ruby implementations (as far as they do implement the 1.9.1 standard syntax and core functinoality.)

I (manveru) will not provide a version of FFI::Tk for 1.8.x, there may be other persons that undertake this step, but due to lack of true encoding support it will be significant overhead to cater to both versions as you can see if you read a bit through the stdlib tk library. We will provide only wrapping for the standard distribution of tcl/tk as of version 8.5.7. Earlier versions have not been tested, and later versions may be used by taking advantage of the Tcl stub mechanism.

Custom extensions of tcl/tk may be wrapped by other people, and we will add a link to any such project, but we try to keep things simple here.

A comprehensive suite of specs describes the behaviour of FFI::Tk as well as possible.

The namespaces used are:

  • Tk
  • FFI::Tk
  • FFI::Tcl

The Tk namespace conflicts with the name of the Ruby's stdlib tk, but the use of them within one application is mutually exclusive anyway.

License

FFI::Tk is distributed under MIT license. Parts of the documentation were obtained from the tcl/tk manpages and modified to clarify and apply to the specifics of the FFI::Tk wrapper. These parts of the documentation are under Tcl license.

The licenses can be found in doc/TCL_LICENSE and doc/MIT_LICENSE respectively.