# Looking for reference for Ruby/Tk and Ruby/MySQL

**URL:** <https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753>\
**Category:** Ruby\
**Created:** [September 15, 2006, 2:07am UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753 "2006-09-15T02:07:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 15, 2006, 2:07am UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/1 "2006-09-15T02:07:20Z")

</div>

Good evening,

I need to create an app that will use Ruby/TK and Ruby/MySql.  
It will be a standalone pc app…

I’m going thru the “Pickaxe” book…and it contains a chapter on Tk -  
but I’m looking for a good reference that covers Ruby and Tk in greater  
detail. I’ll be doing a lot of mathematical curve drawing [ie, plotting  
some statistical functions].

The “Pickaxe” doesn’t cover databases…I’m particularly interested in  
using MySQL with Ruby.

I prefer textbooks…

Will someone make a recommendation.

THX,  
Pat

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 15, 2006, 4:10am UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/2 "2006-09-15T04:10:56Z")

</div>

Patrick L. wrote:

> The “Pickaxe” doesn’t cover databases…I’m particularly interested in  
> using MySQL with Ruby.
> 
> I prefer textbooks…
> 
> Will someone make a recommendation.
> 
> THX,  
> Pat

I can’t help you on MySQL – I’m a PostgreSQL fanatic. As far as Ruby  
Tk, the recommendation in the Pickaxe book is to pick up “Mastering  
Perl/Tk” and just convert to Ruby. You’ll also find lots of examples in  
Tcl when you load Tcl and Tk to port to Ruby.

That said, unless you need Windows support, I’d recommend QTRuby. The  
documentation is much better than what’s available for _Ruby_ Tk,  
especially if you consider the Pragmatic Programmers’ “Friday” series  
PDF book.

I think the QT widgets look prettier than the Tk widgets as well. 🙂

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 15, 2006, 6:02pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/3 "2006-09-15T18:02:55Z")

</div>

Patrick L. wrote:

> Good evening,  
> …  
> Will someone make a recommendation.

This link has Ruby/TK class descriptions, but not much how-to info:  
[http://www.jbrowse.com/text/rubytk\_en.html](http://www.jbrowse.com/text/rubytk_en.html)

Cheers

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 15, 2006, 6:12pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/4 "2006-09-15T18:12:56Z")

</div>

On Fri, 15 Sep 2006, Patrick L. wrote:

```
    [...]

```

> but I’m looking for a good reference that covers Ruby and Tk in greater

To quote my ruby page [1]:

Resources for Tk include [Ruby/Tk  
Tutorial](http://httpd.chello.nl/k.vangelder/ruby/learntk/); a three part article by Christopher Roach - parts  
[1](http://www.macdevcenter.com/pub/a/mac/2004/06/25/ruby_pt1.html),  
[2](http://www.macdevcenter.com/pub/a/mac/2004/07/23/ruby_pt1.html)  
and [3](http://www.macdevcenter.com/pub/a/mac/2004/07/27/ruby_pt3.html);  
[Ruby-Tk FAQ](http://approximity.com/ruby/rubytk.html);  
and [Ruby/Tk  
classes and Modules](http://www.jbrowse.com/text/rubytk_en.html).

```
    HTH
    Hugh

```

[1] Sorry if that sounds egotistical, it’s just that it explains the  
format, and from where I dug out the info. If you really want  
the url it’s [http://www.eng.cse.dmu.ac.uk/~hgs/ruby/](http://www.eng.cse.dmu.ac.uk/~hgs/ruby/)

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 16, 2006, 5:54pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/5 "2006-09-16T17:54:45Z")

</div>

From: Patrick L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Looking for reference for Ruby/Tk and Ruby/MySQL  
Date: Fri, 15 Sep 2006 09:08:06 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> I’m going thru the “Pickaxe” book…and it contains a chapter on Tk -

On “Pickaxe” book, “command” option of TkScrollbar and yscrollcommand  
option of the scrolled widget are used for scrolling.  
Of course, that has no problem except bothering you.  
However, Ruby/Tk supports “xscrolbar” method and “yscrollbar” method  
for scrollable widgets. Those methods make such relationship between  
a widget and a scrollbar.

## ------------------------------------------------- list\_w = TkListbox.new(frame, ‘selectmode’ =\> ‘single’) scroll\_bar = TkScrollbar.new(frame, ‘command’ =\> proc { |\*args| list\_w.yview \*args }) scroll\_bar.pack(‘side’ =\> ‘left’, ‘fill’ =\> ‘y’) list\_w.yscrollcommand(proc { |first,last| scroll\_bar.set(first,last) })

## | v -----\<use “yscrollbar” method\>----------------------------------------- list\_w = TkListbox.new(frame, ‘selectmode’=\>‘single’) list\_w.yscrollbar(TkScrollbar.new(frame).pack(‘side’=\>‘left’, ‘fill’=\>‘y’))

If you want to scroll simultaneously some listboxes by one scrollbar,  
TkScrollbar#assign method may help you.  
Please see the example “ext/tk/sample/tkmultilistframe.rb” on your  
Ruby source tree.

> ```
> I'll be doing a lot of mathematical curve drawing [ie, plotting 
> 
> ```
> 
> some statistical functions].

Ruby/Tk can support many (almost all) of graph libraries which can  
work with Tcl/Tk.  
Even if there is no Ruby/Tk’s wrapper for such graph library, Ruby/Tk  
can call Tcl/Tk’s commands to control the library with Tk.tk\_call.  
If 2D graphs are enough for your purpose, BLT extension may be suitable.

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 22, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/6 "2006-09-22T12:17:07Z")

</div>

Patrick L. wrote:

> Good evening,
> 
> I need to create an app that will use Ruby/TK and Ruby/MySql.  
> It will be a standalone pc app…
> 
> I’m going thru the “Pickaxe” book…and it contains a chapter on Tk -  
> but I’m looking for a good reference that covers Ruby and Tk in greater  
> detail. I’ll be doing a lot of mathematical curve drawing [ie, plotting  
> some statistical functions].
> 
> The “Pickaxe” doesn’t cover databases…I’m particularly interested in  
> using MySQL with Ruby.
> 
> I prefer textbooks…
> 
> Will someone make a recommendation.
> 
> THX,  
> Pat

I’m ok now with Tcl/Tk…  
However, I’m still baffled by connecting Rudy to MySql…  
I tried downloading Gem but couldn’t get past the question requesting  
what I wanted to install…the list contained about 30 items…each  
numbered…I replied with a 2 but it was rejected…

It looks like DBI is another way to go…

I’d appreicate any advice.

Thanks,  
Pat

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 22, 2006, 9:45pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/7 "2006-09-22T21:45:46Z")

</div>

M. Edward (Ed) Borasky wrote:

> Patrick L. wrote:
> 
> > > 
> > 
> > I’m ok now with Tcl/Tk…  
> > Pat
> 
> Some of the gems have two versions – a source version for those folks  
> like me who run a Gnu/Linux platform, and a pre-compiled Windows  
> version. And if the gem has multiple version numbers, there will be two  
> choices for each of those. So in general:
> 
> 1. If you’re on Windows, pick the “mswin” version, otherwise, pick the  
> source version.
> 2. Unless you have reasons to use an older version, pick the most recent  
> one.
> 3. If you did _that_ and “got rejected”, file a bug report with the  
> package maintainer.

Ed,  
Thanks for the ‘heads up’…I’ll try this again over the weekend…  
Good weekend,  
Pat

---

<div class="post-metadata">

**Author:** ![lynchnco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c77e96/32.png) [@lynchnco](https://www.ruby-forum.com/u/lynchnco)\
**Post date:** [September 22, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/looking-for-reference-for-ruby-tk-and-ruby-mysql/68753/8 "2006-09-22T15:53:19Z")

</div>

Patrick L. wrote:

> > 
> 
> I’m ok now with Tcl/Tk…  
> Pat

Some of the gems have two versions – a source version for those folks  
like me who run a Gnu/Linux platform, and a pre-compiled Windows  
version. And if the gem has multiple version numbers, there will be two  
choices for each of those. So in general:

1. If you’re on Windows, pick the “mswin” version, otherwise, pick the  
source version.
2. Unless you have reasons to use an older version, pick the most recent  
one.
3. If you did _that_ and “got rejected”, file a bug report with the  
package maintainer.
