2004-07-01 05:38:48 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'tk'
|
|
|
|
require 'tkextlib/vu/charts'
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
xbm = File.join(File.dirname(File.expand_path(__FILE__)), 'm128_000.xbm')
|
|
|
|
|
|
|
|
sval = [ 11, 22, 33, 44, 55, 66, 77, 88, 99 ]
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
l0 = TkLabel.new(:width=>128, :height=>128,
|
2004-10-11 00:51:21 -04:00
|
|
|
:bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
c0 = TkCanvas.new(:width=>80, :height=>80,
|
|
|
|
:insertwidth=>0, :highlightthickness=>0,
|
|
|
|
:selectborderwidth=>0, :borderwidth=>2,
|
|
|
|
:relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5,
|
2004-10-11 00:51:21 -04:00
|
|
|
:anchor=>:c)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80,
|
|
|
|
:background=>"#b7c0d7", :fill=>'slategray3',
|
|
|
|
:jumpscroll=>1, :outline=>'black',
|
|
|
|
:scaleline=>'blue', :stripline=>'red',
|
2004-10-11 00:51:21 -04:00
|
|
|
:selected=>1, :values=>sval)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
TkcText.create(c0, 40, 40,
|
2004-10-11 00:51:21 -04:00
|
|
|
:text=>Tk::TCL_PATCHLEVEL, :fill=>'cyan', :tags=>'text')
|
2004-07-01 05:38:48 -04:00
|
|
|
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
l1 = TkLabel.new(:width=>128, :height=>128,
|
2004-10-11 00:51:21 -04:00
|
|
|
:bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
c1 = TkCanvas.new(:width=>80, :height=>80,
|
|
|
|
:insertwidth=>0, :highlightthickness=>0,
|
|
|
|
:selectborderwidth=>0, :borderwidth=>2,
|
|
|
|
:relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5,
|
2004-10-11 00:51:21 -04:00
|
|
|
:anchor=>:c)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80,
|
|
|
|
:background=>"#b7c0d7", :scalevalue=>10.0,
|
|
|
|
:autocolor=>true, :selected=>1,
|
|
|
|
:outline=>'black', :barline=>'yellow',
|
2004-10-11 00:51:21 -04:00
|
|
|
:scalelinestyle=>0)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80,
|
|
|
|
:background=>"#b7c0d7", :scalevalue=>10.0,
|
|
|
|
:autocolor=>true, :selected=>1,
|
|
|
|
:outline=>'black', :fill=>"#b7c0d7",
|
2004-10-11 00:51:21 -04:00
|
|
|
:barline=>'red', :scalelinestyle=>22)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
l2 = TkLabel.new(:width=>128, :height=>128,
|
2004-10-11 00:51:21 -04:00
|
|
|
:bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
c2 = TkCanvas.new(:width=>80, :height=>80,
|
|
|
|
:insertwidth=>0, :highlightthickness=>0,
|
|
|
|
:selectborderwidth=>0, :borderwidth=>2,
|
|
|
|
:relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5,
|
2004-10-11 00:51:21 -04:00
|
|
|
:anchor=>:c)
|
2004-07-01 05:38:48 -04:00
|
|
|
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80,
|
|
|
|
:text=>"Tcl/Tk", :space=>0, :color=>'red',
|
|
|
|
:outline=>'red', :font=>'Helvetica 14 bold',
|
|
|
|
:fill=>'', :stipple=>'', :bar=>'blue',
|
|
|
|
:orient=>:vertical, :anchor=>:s,
|
|
|
|
:relheight=>1.0, :relwidth=>0.15,
|
2004-10-11 00:51:21 -04:00
|
|
|
:relx=>0.1, :rely=>0.0)
|
2004-07-01 05:38:48 -04:00
|
|
|
rescue
|
|
|
|
stick = nil
|
|
|
|
TkcText.new(c2, 40, 10, :text=>"No Sticker Item")
|
|
|
|
end
|
|
|
|
|
|
|
|
c_do = proc{
|
|
|
|
st[:values] = rand() * 100
|
|
|
|
|
|
|
|
bar1[:values] = rand() * 10
|
|
|
|
bar2[:values] = rand() * 10
|
|
|
|
|
|
|
|
stick[:rely] = rand() * 100 * 0.01 if stick
|
|
|
|
}
|
|
|
|
|
|
|
|
c0.bind('1', c_do)
|
|
|
|
|
|
|
|
TkTimer.new(100, -1, c_do).start
|
|
|
|
|
|
|
|
Tk.root.bind('q', proc{exit})
|
|
|
|
|
|
|
|
Tk.mainloop
|