Hi Kurt
Here''s a quick example of how to draw primitives onto a Device Context.
WxWidgets also has a specialised class WxPlotWindow, but I don''t think
that''s available yet in WxRuby.
http://wxwidgets.org/manuals/2.4.2/wx296.htm#wxplotwindow
cheers
alex
----------------
require ''wxruby''
class MyDrawingFrame < Wx::Frame
def initialize(*args)
super(*args)
evt_paint { on_paint }
end
def on_paint
paint do | dc |
dc.clear
dc.draw_line( 0, 0, 50, 100)
dc.draw_line( 50, 100, 100, 75)
dc.draw_text( ''a label'', 52, 102)
end
end
end
class MyApp < Wx::App
def on_init()
frame = MyDrawingFrame.new(nil, -1, ''Drawing'')
frame.set_client_size( Wx::Size.new(200,200))
frame.show()
end
end
MyApp.new().main_loop()
Kurt Dresner wrote:
> Anyone know how to draw in wxRuby? I want to draw a graph, and have
> it update as new data comes in. I see stuff about Device Contexts,
> but I can''t find anything about how to use them, associate them
with a
> panel, or anything like that.
>
> -Kurt
> _______________________________________________
> wxruby-users mailing list
> wxruby-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>
>