Forum: Ruby Question about using ruby and gtk to make an app

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
703cd1224835ae3acb7a4d2724001bd5?d=identicon&s=25 David Torres (verbena1)
on 2007-03-25 22:15
I have a question about using ruby and ruby-gtk2.  I have a simple gui
and am using SourceView as my text buffer and have added a menu to open
and save files.  My question is how in the world to I open a file and
display it within my buffer?

so far my open method is:

callback_open = {
      p "Open is called."
      dialog ="Open File",nil,
      if == Dialog::RESPONSE_ACCEPT
        @filename = #{dialog.filename}
        file =


after the file variable line I have tried different things to actually
add the text to the buffer but none seem to work.  I checked the API but
I'm not sure if their is a TextBuffer method that I can use to read in
the file line by line.

Any help would be appreciated.

David Torres
3d4490d422bd40a4c5f460a0ddc73dc3?d=identicon&s=25 Demetrius Gallitzin (Guest)
on 2007-03-26 20:17
(Received via mailing list)
Chapter 2: GUI Toolkits for Ruby

This is a long but good free sample chapter from the _Ruby Developer's

The section on "Using the Glade GUI Builder" (gtk) is nice, but I wish
maybe for one or two more full examples of it.  I think glade or
glade-type tools can have a big impact by keeping the GUI and your
application as interchangeable parts.  It is also multi-platform.

Author: Michael Neumann
ISBN: 1928994644
January 18, 2002
New Price: $29.95  (The free sample chapter is a mini-book on GUI
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-03-26 20:46
(Received via mailing list)
i am not sure what your question is, but i am using ruby and glade a
Very, very easy.
this site
has lots of good stuff. There is even a single command in ruby that will
allow you to create a skeleton
rb file to use with a glade file, its ruby-glade-create-template > yourapp.rb
 very cool,
This topic is locked and can not be replied to.