TKXXS

References

TKXXS_CLASSES is intended for developers only.

Description

TKXXS provides a very simple and very easy to use GUI (graphical user interface) for Ruby; It gives you a persistent output window and popping up (modal) dialogs for input; For a screenshot, see: https://github.com/Axel2/tkxxs/blob/master/images/screenshot.png; I tested it on Windows, only; Got user report, that it works on Ubuntu, too.

TKXXS shall:

Drawbacks:

TKXXS uses TK (easy to install).

Dialogs

As of now, the following dialogs exist:

All dialog-methods have three arguments:

Small Example (see: samples/small_example.rb)

require 'tkxxs'
include TKXXS
class MyTinyUI
  def initialize(  )
    @outW = OutW.new  # create Output Window
    @outW.puts "Hello"
    ask_name
    Tk.mainloop  # You always needs this!
  end # initialize
  def ask_name(  )
    name = ask_single_line("Your name?")
    @outW.puts "Hello #{name}."
  end # ask_name
end
MyTinyUI.new

When running this script, you should resize the popping up windows as you like; size and position will be stored for the next time.

You close the application simply by clicking the close-icon on top of the output window.

More elaborated example

See samples/big_example.rb

configSection

Normally, you need not care about it.

The hash-argument of the dialog methods take as key :configSection. The value of this key sets the section name of the configuration file, where configuration setting of this dialog are stored and read from. Configuration settings are, for example: Window size and position, and recent dirs/files and favorite dirs/files.

Key may be String, Integer, Float or nil, but not Symbol. nil is the default section.

The config section remains unchanged, unless it is set to a new value by either using:

Conf#section = ...

or by setting the :configSection of the hash-argument of the dialog methods.

You can use :configSection for example, if you want to have different favorite dirs for two different choose_dir-dialogs. Example code:

CONF = Conf.new # This is set inside TKXXS
...
old_section = CONF.section
left_dir = choose_dir( 
  :configSection=>'left'
)
right_dir = choose_dir( 
  :configSection=>'right',
)
CONF.section = old_section
...

Installation

Prerequisites

Install

gem install tkxxs

Misc

TKXXS stands for “TK very very small”.

TODO

Future

2013-12-29: I wrote this code several years ago. Now I thought I should document it and give it to public. I'll not develop it further, but I'll try to include pull requests.

For developers

LICENSE:

(The MIT License)

Copyright © 2010-2014 Axel Friedrich and contributors (see the CONTRIBUTORS file)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.