wxRuby and other GUI toolkits

Discussion in 'Ruby' started by Nick, Dec 14, 2004.

  1. Nick

    Nick Guest

    So, having subscribed recently to the ruby-talk mailing list, I've
    noticed that wxruby doesn't seem to have the "respect" of other GUI
    libraries. I know GUI-library preference is a holy war almost up there
    with vi versus emacs, but since I'm a wxruby developer, I'd like to know
    what people "don't" like about wxruby. Otherwise, how else do we improve?

    Browsing online, I've found a few complaints:

    Difficulty in getting it installed - Daniel Sheppard,
    Use of ugly integer values for event handlers -

    It's a good start (though I don't know what platform Mr. Sheppard is
    trying to install on), but any other discussion would be most helpful.


    Nick, Dec 14, 2004
    1. Advertisements

  2. Welcome, Nick !

    And that will change, now that you are here ;-)

    Seriously, having one of the core developers on this
    ML helps a lot ... I can vouche for that based on my
    experience with FxRuby. Lyle Johnson's stupendous
    presence here increases the comfort level by two
    orders of magnitude.
    Now, that I have written a full blown (but tiny)
    commercial app in wxRuby, I can say that one area
    which we (almost always) can improve upon is
    documentation and sample code. I will gladly
    contribute on both fronts.
    This situation has improved a lot. Although, IMO, at
    least on the Windows platform, I would like for it to
    be optionally installed. I am aware that this would
    add to the girth of the one-click installer, so it
    could be an issue.
    Hmmm .. that did not bother me much. Isn't it an issue
    with the other GUI's too ?
    I must mention here that the lack of
    documentation/samples has been compensated by
    all the help I get on the wxRuby mailing list.

    Thank you !
    -- shanko

    Do you Yahoo!?
    Yahoo! Mail - You care about security. So do we.
    Shashank Date, Dec 14, 2004
    1. Advertisements

  3. Nick

    Craig Moran Guest

    I'm looking into wxRuby myself after looking at FXRuby and having
    marginal success. I am a returning list member after being gone for
    ~1 year. Here is some sample code that works for me on Windows with
    the One-Click Installer and wxRuby. FXRuby and Tk both had PigIt
    examples in the sample directories, yet wxRuby didn't. This is my
    first attempt at wxRuby, so feel free to slice and dice.
    Warm Regards-

    # This is a wxRuby version of Thomas and Hunt's timeless classic, Pig It!
    # example (from the "Ruby/Tk" chapter of "Programming Ruby".)
    # Implemented by Craig Moran

    require 'wxruby'
    include Wx

    Button_Pig = 1
    Button_Exit = 2

    class PigFrame < Frame
    def initialize
    super(nil, -1, "Pig", Point.new(100, 100), Size.new(300, 130))
    panel = Panel.new(self, -1)
    sizer = BoxSizer.new(VERTICAL)
    pigText = StaticText.new(panel, -1, "Enter text:", DEFAULT_POSITION)
    sizer.add(pigText, 0, ALIGN_CENTER)
    @text = TextCtrl.new(panel, -1, "", DEFAULT_POSITION,
    sizer.add(@text, 1, GROW|ALL, 2)
    pigButton = Button.new(panel, Button_Pig, "Pig It!", DEFAULT_POSITION)
    sizer.add(pigButton, 0, ALIGN_CENTER|ALL, 2)
    exitButton = Button.new(panel, Button_Exit, "Exit", DEFAULT_POSITION)
    sizer.add(exitButton, 0, ALIGN_CENTER|ALL, 2)
    evt_button(Button_Pig) {showPig}
    evt_button(Button_Exit) {onExit}

    def pig(word)
    leadingCap = word =~ /^A-Z/
    res = case word
    when /^aeiouy/
    when /^([^aeiouy]+)(.*)/
    leadingCap ? res.capitalize : res

    def showPig
    @text.set_value(@text.get_value.split.collect{|w| pig(w)}.join(" "))

    def onExit

    class PigApp < App
    def on_init

    Craig Moran, Dec 14, 2004
  4. Nick

    Nick Guest

    Thanks! I'll add that to the samples (worked on my Mac OS X box without
    a hitch).


    Nick, Dec 14, 2004
  5. Works on Linux with Ruby 1.8.1.

    Erik V.
    Erik Veenstra, Dec 14, 2004
  6. Then why not gravitate toward FXRuby?

    It already allows a lot of what was discussed in the given thread.

    Richard Lyman, Dec 14, 2004
  7. Nick

    Zach Dennis Guest

    FXRuby doesn't necessarily appeal to all developers with it being GPL'd.
    And to the late wxruby project lead Kevin Smith:

    "On the bright side, wx is still the only liberally-licensed,
    full-featured, native-widget, cross-platform GUI toolkit. If those
    features are important to you, then wx is really where you want to be. "

    Zach Dennis, Dec 14, 2004
  8. Hello Zach,

    ZD> FXRuby doesn't necessarily appeal to all developers with it being GPL'd.
    ZD> And to the late wxruby project lead Kevin Smith:

    It's LGPL not GPL.
    But yes LGPL has some problems.
    Lothar Scholz, Dec 14, 2004
  9. TIMTOWTDI. I do it a bit different than all of the samples. I prefer
    the following way, since it helps me see the GUI structure when I'm
    looking at the code.

    Here are some non-functioning (since they are only part of the
    application's code) examples.

    Example 1:
    FXMenuPane.new(@mainwin){ |hide_and_remind_menu|
    FXMenuTitle.new(menu_bar,"Hide and Remind",nil,hide_and_remind_menu)
    seconds").connect(SEL_COMMAND) do hide_and_remind_sec(5) end
    seconds").connect(SEL_COMMAND) do hide_and_remind_sec(15) end
    minutes").connect(SEL_COMMAND) do hide_and_remind_sec( (60*30) ) end
    hours").connect(SEL_COMMAND) do hide_and_remind_sec( (60*60*2) ) end
    hours").connect(SEL_COMMAND) do hide_and_remind_sec( (60*60*4) ) end
    hours").connect(SEL_COMMAND) do hide_and_remind_sec( (60*60*6) ) end
    tomorrow").connect(SEL_COMMAND) do hide_and_remind(8) end
    tomorrow").connect(SEL_COMMAND) do hide_and_remind(10) end
    tomorrow").connect(SEL_COMMAND) do hide_and_remind(12) end
    tomorrow").connect(SEL_COMMAND) do hide_and_remind(16) end
    tomorrow").connect(SEL_COMMAND) do hide_and_remind(20) end

    Example 2:

    Notice I'm not saying anything bad about wxWidgets. In fact I'm a bt
    jealous of the native look-n-feel thing... :)

    I'm just trying to show that FXRuby has excellent support for...
    ruby-esque-ness (if that's a word)

    Richard Lyman, Dec 14, 2004
  10. FXRuby and FOX are actually LGPL'd (if that makes a difference to
    you), and FOX's license is even a modified LGPL to allow more room.

    Richard Lyman, Dec 14, 2004
  11. Nick

    Nick Guest

    It's a good suggestion, though a little outside the scope of the
    wxWidgets project. Lit window has conceptually similar to what your
    talking about for C++.


    I don't want this to get into a battle of which GUI toolkit is more
    virtuous; there are different toolkits because people want different
    functionality. I'd like to hear from anybody who has tried wxruby and
    didn't like it, and why they didn't like it.

    Nick, Dec 14, 2004
  12. Nick

    David Ross Guest

    Licensing issue is very big complaint of the other toolkits.
    I usually compile modules statically, so LGPL wont work.
    WideStudio is a toolkit which is licensed under the MIT/X,
    *and* includes its own IDE tools. It supports C/C++, Ruby,
    Perl, and Python gui code generation.

    David Ross
    Want to see others who are interested in Ruby?
    See more Info at [ Website: http://www.rubymine.org/?q=IRC ]
    #ruby-talk on Freenode [ IRC: irc://freenode.net/ruby-talk ]

    Hazzle free packages for Ruby?
    RPA is available from [ Website: http://www.rubyarchive.org/ ]
    David Ross, Dec 14, 2004
  13. Nick

    Nick Guest

    To add to my last post: I'd also love to hear if you do GUI developement
    and haven't tried wxruby, why haven't you tried it?

    Nick, Dec 14, 2004
  14. Hello Nick,

    N> I don't want this to get into a battle of which GUI toolkit is more
    N> virtuous; there are different toolkits because people want different
    N> functionality. I'd like to hear from anybody who has tried wxruby and
    N> didn't like it, and why they didn't like it.

    You also like to hear why i don't like wxWidgets ?
    Lothar Scholz, Dec 15, 2004
  15. Nick

    Zach Dennis Guest

    Perhaps that would be best for an offlist posting. If you have the
    courteousy to do it offlist be sure to send me a copy...

    Zach Dennis, Dec 15, 2004
  16. Nick

    Nick Guest

    Well, I'd like to hear it. I don't think I can really do much about it
    though. :)

    Nick, Dec 15, 2004
  17. Please see number 2 in the FOX LGPL addendum.

    Maybe that will resolve your difficulty with static linking and the LGPL.

    Richard Lyman, Dec 15, 2004
  18. Nick

    David Ross Guest

    David Ross, Dec 15, 2004
  19. Nick

    Eric Hodel Guest

    Eric Hodel, Dec 15, 2004
  20. That would be nice - wouldn't it?

    Richard Lyman, Dec 15, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.