Class: BLT_Graph_Demo
Instance Method Summary collapse
-
#initialize ⇒ BLT_Graph_Demo
constructor
A new instance of BLT_Graph_Demo.
Constructor Details
#initialize ⇒ BLT_Graph_Demo
Returns a new instance of BLT_Graph_Demo.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'sample/tkextlib/blt/graph6.rb', line 64 def initialize @graph = Tk::BLT::Graph.new(:widgetname=>'graph') @root = Tk.root @root.minsize(0, 0) _set_vectors() (1..39).each{|i| @graph.element_create("V#{i}", :x=>@x, :y=>@v[i])} @top = Tk::BLT::Tile::Toplevel.new =begin legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend', :without_creating=>true) @graph.legend_configure(:position=>legend) =end # legend = @graph.legend_window_create(@top, :widgetname=>'legend') legend = @graph.legend_window_create(@top) legend.pack(:fill=>:both, :expand=>true) Tk::BLT::Table.add(@root, @graph, [0,0], :fill=>:both) @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red', :command=>proc{exit}) Tk::BLT::Table.add(@root, @quit_btn, [1,0], :anchor=>:e, :padx=>10) @graph.zoom_stack @graph.crosshairs @graph.closest_point @graph.print_key @graph.legend_bind(:all, 'ButtonRelease-1', proc{|w| highlightTrace(w)}, '%W') @graph.legend_bind(:all, 'ButtonRelease-3', proc{|w| w.legend_deactivate('*') active = w.element_activate w.element_deactivate(*active) }, '%W') end |