mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00

* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
101 lines
2.2 KiB
Ruby
101 lines
2.2 KiB
Ruby
#!/usr/bin/env ruby
|
|
|
|
require 'tk'
|
|
require 'tkextlib/vu/charts'
|
|
|
|
#######################################
|
|
|
|
c = TkCanvas.new.pack
|
|
|
|
begin
|
|
st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10)
|
|
rescue
|
|
Tk.messageBox(:type=>'ok', :title=>"No sticker Item",
|
|
:message=>"This build of vu does not include the sticker item")
|
|
exit
|
|
end
|
|
|
|
c.destroy
|
|
|
|
#---
|
|
#--- set STRING {{x0 y0 x1 y1} {...text...} {resize point: center}
|
|
|
|
#sti_conf = [ [10, 10, 180, 180], "Sticker äöüß@²³¼½¾", :center ]
|
|
#txt_conf = [ [210, 210], "Text äöüß@²³¼½¾", :center ]
|
|
sti_conf = [ [10, 10, 350, 350],
|
|
Tk::UTF8_String('Sticker \u00E4\u00F6\u00FC\u00DF\u0040\u00B2\u00B3\u00BC\u00BD\u00BE'),
|
|
:center ]
|
|
txt_conf = [ [250, 250],
|
|
Tk::UTF8_String('Text \u00E4\u00F6\u00FC\u00DF\u0040\u00B2\u00B3\u00BC\u00BD\u00BE'),
|
|
:center ]
|
|
|
|
#p sti_conf
|
|
|
|
fnt = TkFont.new('Helvetica 24 bold')
|
|
|
|
#---GUI
|
|
c = TkCanvas.new(:width=>500, :height=>500, :bg=>'aquamarine3').pack
|
|
|
|
#---CRRW Use the technique of eval the coord ...
|
|
sti = Tk::Vu::TkcSticker.new(c, sti_conf[0]){
|
|
anchor sti_conf[2]
|
|
bar 'black'
|
|
color 'red'
|
|
fill ''
|
|
font fnt
|
|
lefttrunc 0
|
|
outline ''
|
|
relheight 0.0
|
|
relwidth 0.0
|
|
relx 0.0
|
|
rely 0.0
|
|
space 0
|
|
stipple ''
|
|
tags 'sti'
|
|
text sti_conf[1]
|
|
width 0
|
|
orient :vertical
|
|
minwidth 0
|
|
minheight 0
|
|
maxwidth 32767
|
|
maxheight 32767
|
|
}
|
|
|
|
txt = TkcText.new(c, txt_conf[0]){
|
|
activefill ''
|
|
activestipple ''
|
|
anchor txt_conf[2]
|
|
disabledfill ''
|
|
disabledstipple ''
|
|
fill 'blue'
|
|
font fnt
|
|
justify :left
|
|
offset '0,0'
|
|
state ''
|
|
stipple ''
|
|
tags ['tex']
|
|
text txt_conf[1]
|
|
width 0
|
|
}
|
|
|
|
#---BINDINGS
|
|
c.bind('2', proc{
|
|
sti[:orient] = :horizontal
|
|
txt[:width] = 0 # horizontal
|
|
})
|
|
|
|
c.bind('3', proc{
|
|
sti[:orient] = :vertical
|
|
txt[:width] = 1 # top down
|
|
})
|
|
|
|
Tk.root.bind('p', proc{
|
|
c.postscript(:file=>'DEMO.ps')
|
|
puts "DEMO.ps printed"
|
|
})
|
|
|
|
Tk.root.bind('q', proc{exit})
|
|
|
|
#####################
|
|
|
|
Tk.mainloop
|