From: sujeet kumar Date: 2005-06-17T07:23:37+09:00 Subject: Re: How to make a browser in Ruby Tk When I run Ruby's source archive ("ext/tk/sample/tkextlib/tkHTML/hv.rb"). I got error /usr/local/lib/ruby/1.8/tk/package.rb:86:in `require': TkPackage can't find package Tkhtml (RuntimeError) from /usr/local/lib/ruby/1.8/tkextlib/tkHTML/htmlwidget.rb:15 from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13:in `require' from /usr/local/lib/ruby/1.8/tkextlib/tkHTML.rb:13 from hv.rb:10:in `require' from hv.rb:10 When i run the program in example given by you it also gives same error. I want to display HTML text in Ruby widget as the HTML file displays in web browser. bye sujeet On 6/16/05, Hidetoshi NAGAI wrote: > From: sujeet kumar > Subject: How to make a browser in Ruby Tk > Date: Thu, 16 Jun 2005 22:57:40 +0900 > Message-ID: <734fb92405061606571300ad7d@mail.gmail.com> > > I want to make a web browser in Ruby Tk. I used "net/http" to connect > > to net. url is to be given in Tk entry. I am getting data from url > > using "response = http.get(url)" . when i printed "response.body" it > > gives the HTML source of the given Url. Now I want to display the > > content in Ruby Frame. How can i print this ( data of url) in Ruby > > Frame. > > Probably one of the easiest way is to use TkHTML extension > (see http://www.hwaci.com/sw/tkhtml/index.html). > If you install the extension on your Tcl/Tk environment > (for example, you use ActiveTcl binary package) and use > the Tcl/Tk's library on your Ruby/Tk, please try a browser > example by Ruby/Tk + TkHTML. That is included in Ruby's > source archive ("ext/tk/sample/tkextlib/tkHTML/hv.rb"). > If the HTML text which you want to browse is a simple one, > the following may be enough to show the formatted document. > -------------------------------------------------------------- > require 'tk' > require 'tkextlib/tkHTML' > > ... read a HTML-doc, and set it to the variable 'doc' ... > > hv = Tk::HTML_Widget.new.pack > hv.parse(doc) > > ... > -------------------------------------------------------------- > -- > Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) > >