From: Morton Goldberg Date: 2006-11-23T09:41:27+09:00 Subject: Re: Only one root window in RubyTk 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? > > This is the extract: > > $window['root'] = TkRoot.new { title "ttlog : version 2.2" } > puts $window['root'] > > $window['today'] = TkRoot.new { title "Todays news" } > puts $window['news'] 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. #! /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 # # Hope this helps. Regards, Morton