Thanks! I'll add that to the samples (worked on my Mac OS X box without a hitch). Nick Craig Moran wrote: > 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- > Craig > > # 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, > DEFAULT_SIZE, TE_MULTILINE) > 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) > panel.set_sizer(sizer) > show(true) > evt_button(Button_Pig) {showPig} > evt_button(Button_Exit) {onExit} > end > > def pig(word) > leadingCap = word =~ /^A-Z/ > word.downcase! > res = case word > when /^aeiouy/ > word+"way" > when /^([^aeiouy]+)(.*)/ > $2+$1+"ay" > else > word > end > leadingCap ? res.capitalize : res > end > > def showPig > @text.set_value(@text.get_value.split.collect{|w| pig(w)}.join(" ")) > end > > def onExit > close(true) > end > end > > class PigApp < App > def on_init > PigFrame.new > end > end > > PigApp.new.main_loop > > > On Wed, 15 Dec 2004 02:19:48 +0900, Shashank Date <shanko_date / yahoo.com> wrote: > >>Welcome, Nick ! >> >>--- Nick <devel / nicreations.com> wrote: >> >> >>>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. >> >>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. >> >> >>>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? >> >>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. >> >> >>>Browsing online, I've found a few complaints: >>> >>>Difficulty in getting it installed - Daniel >>>Sheppard, >>>http://www.jroller.com/page/soxbox/ >> >>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. >> >> >>>Use of ugly integer values for event handlers - >>>http://homepages.ihug.com.au/~naseby/31.html >> >>Hmmm .. that did not bother me much. Isn't it an issue >>with the other GUI's too ? >> >> >>>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. >> >>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 ! >> >> >>>Thanks, >>> >>>Nick >> >>-- shanko >> >> >>__________________________________ >>Do you Yahoo!? >>Yahoo! Mail - You care about security. So do we. >>http://promotions.yahoo.com/new_mail >> >> > > > > >