From: sujeet kumar <sujeetkr / gmail.com> 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)