Len Lawrence
11/23/2006 7:32:00 PM
On Thu, 23 Nov 2006 09:41:27 +0900, Morton Goldberg wrote:
> On Nov 22, 2006, at 5:50 PM, Len Lawrence wrote:
>
>> I have just started using ruby after 15 years with Tcl/Tk/C/C++
>> and have encountered a problem trying to create a second
>> toplevel window. This was trivial in tcl. In ruby the second
>> window has the same object reference as the first, so everything
>> gets packed together.
>>
>> Is this a bug or a feature of the ruby Tk implementation?
>>
>
> AFAIK, you can't have two root windows in Ruby/Tk. However, you can
> put up two windows by creating a toplevel window as the second window.
>
> <code>
> #! /usr/bin/env ruby -w
>
> require "tk"
>
> root = TkRoot.new { title "ttlog : version 2.2" }
> p root
> second = TkToplevel.new(root) { title "Todays news" }
> p second
>
> Tk.mainloop
> </code>
>
> <results>
> #<TkRoot:0x502adc @path=".">
> #<TkToplevel:0x5025dc @classname="Toplevel", @screen=nil,
> @path=".w00000", @db_class=TkToplevel>
> </results>
>
> Hope this helps.
>
> Regards, Morton
Thanks Morton; just what I was looking for. In Tcl you use toplevel
to create what I call a "root" window. The Pickaxe does not go
into much detail - perlTk book in the post.
Thanks again, and apologies for the elementary question.
Len