02月17, 2007

wxRuby2的安装与Demo程序

用gem安装wxruby2

c:>gem install wxruby2-preview

在文件前面增加下列代码

begin
   require "wx"
rescue LoadError => no_wx_err
   begin
     require "rubygems"
     require "wx"
   rescue LoadError
     raise no_wx_err
   end
end

测试:

class TroutApp < Wx::App
   def on_init
     frame = Wx::Frame.new(nil, -1, "Tiny wxRuby Application")
     panel = Wx::StaticText.new(frame, -1, "You are a trout!",
           Wx::Point.new(-1,1), Wx::DEFAULT_SIZE,
           Wx::ALIGN_CENTER)
     frame.show
   end
end

TroutApp.new.main_loop

update:

FOX界面库

require "fox16"
include Foxapplication = FXApp.new("Hello", "FoxTest")

application.init(ARGV)
main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
application.create()
main.show(PLACEMENT_SCREEN)
application.run()

本文链接:http://aztack.wang/post/play-wxruby2.html

-- EOF--

Comments

评论加载中...

注:如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理。