Search code examples
rubyuser-interfacegtk3glade

How to get entry text in glade3 in Ruby?


Its first my first time in stackoverflow to get help. Im making a Ruby GUI with glade3, but i dont really now how to get texts from an entry box? It should read the text from entry box and write it in an excel sheet.

I hope you can help me :)


Solution

  • See example here: https://xrob.wordpress.com/2007/04/20/creating-a-gui-application-using-glade-and-ruby/

    We want to change something in the application so we will need to assign a variable to the widget that we want to alter. We want to alter “label1” and so we insert this code in the button1_clicked function.

    @myEntryBox = @glade.get_widget(“myEntryBox”)
    # You can now access properties like '@myEntryBox.text'
    # Refer to documentation for exact name of the attribute