Ruby-Gtk3 anybody? Which API-reference do you use?
The API-reference for Ruby-Gtk that I can find on the web appears to be terribly outdated. So maybe there is one that I cannot find or something else, that I have missed.
Luckily, I have a few code-examples around and can try to apply the information from the old documentation to the current Gtk3 library and Ruby-Gem. But this is awfully inefficient. Today, I get my hints by 1.) looking at the code, like in: “In deed, the option hash is named ‘options’ in Button::initialize()”2.) checking the available methods, like in: 3.) Calling ri because I am a believer: 4.) trying what I consider possibly correct usage of a method, like in: There must be a way ... PSE note (just in case): I know how to create buttons (and derive/overwrite or use meta-classes) in Gtk3. This was an example. The question is in the subject! |
Apparently there are not many active Ruby, or Ruby-Gtk programmers here at this time, myself included!
As no one else has stepped in I can only offer the results of my own online searches, hopefully there will be something different from yours. Here is the most current Ruby-Gtk3 API I found. The most recent updates look like 25 days ago, then 4 and 5 months ago, but not a lot of activity. I found this Ruby-Gtk Tutorial, dated 2014. Then there is thi ruby-gtk3-tutorial. It is 2 years old and does not look to have much depth, but has quite a few examples. You might stumble across something relevant and not totally ancient there. And this very old site, Programming Ruby/GTK, but it has several complete examples (of unknown applicability to current Ruby and Gtk). Perhaps it can lead to other references. I bought the Pick Axe book long ago, intending to learn Ruby, but choked on the Preface and lost interest early as I recall! I had no actual use for it at the time and could not find its compelling "reason for being". ;) Maybe I should dust it off. |
Thank you astrogeek for all the effort...
Quote:
Quote:
But when you try that on Gtk, ... oh my. All you get is the Gnu-GPL three or four times in a row and a list of constants and class-method names. Felicitations! The classes aren't any better: Code:
:~$ ri Gtk::ToggleButton The Ruby/Gtk-documentation is a mess. The best you can do, is consult the API-docs of the C-Library. At least it is complete and explains... stuff. Unfortunately, though, the ruby-bindings make heavy use of Ruby-mechanisms, such as symbols and variable argument-lists. Only trial&error get you from a documented C-method to running Ruby-code, if there is nobody to explain the difference. Of course, you can *ALWAYS* read the code. Quote:
Thanks again. Michael P.S.: I see that RubyLearning.org has not been updated and that Moodle had not been awful enough. The site and the courses are probably obsolete, now. Pity. |
It is indeed quite messy, but not totally dead; kou still maintains the ruby bindings to gtk here:
https://github.com/ruby-gnome/ruby-gnome I am trying to collect lots of examples into this project here: https://rubygems.org/gems/gtk_paradise But it will be beta for years, simply due to my own lack of time. :\ My aim with gtk_paradise is to make everything nicer to use, simpler to use too, in the long run. And to document a LOT - but sadly, writing documentation is horribly boring so ....... I also have noticed that information is slowly vanishing. This is really bad. Most of my code still is in gtk2; it seems as if the transition from gtk2 to gtk3 really took a big toll. I can not say why ... perhaps it was the mobile area that also had to pay a toll? These days I would honestly consider just using the www-stack. At the least that one is very active. |
I use GTK 3 with C++. A big problem with GTK 3 was that the API remained a moving target right up until the developers called GTK 3.24 "done" and moved on to GTK 4.
I suggest using the latest 3.24 with the native C API. A version from even two years ago is obsolete. Ed |
Yeah, they focus mostly on gtk4 now upstream. I like the CSS of ruby-gtk3 though so I will
probably keep on using it for a longer while. It's more pleasant to work with than with ruby-tk, and I can re-use the CSS (in part) that I use for web-related stuff. |
All times are GMT -5. The time now is 05:32 PM. |