Sha256: a57e3b78737953bcdcf080f6dd21f00496cda948a04639b7da1aee67e009a842
Contents?: true
Size: 1.84 KB
Versions: 4
Compression:
Stored size: 1.84 KB
Contents
#!/usr/bin/env ruby begin require 'wx' rescue LoadError => no_wx_err begin require 'rubygems' require 'wx' rescue LoadError raise no_wx_err end end class TestPanel < Wx::Panel def initialize(parent) super(parent, -1) Wx::StaticText.new(self, -1, "This is an example of static text", Wx::Point.new(20, 10)) Wx::StaticText.new(self, -1, "using the Wx::StaticText Control.", Wx::Point.new(20, 30)) Wx::StaticText.new(self, -1, "Is this blue?", Wx::Point.new(20, 70), Wx::Size.new(90, -1)).set_background_colour(Wx::BLUE) Wx::StaticText.new(self, -1, "align center", Wx::Point.new(120, 70), Wx::Size.new(90, -1), Wx::ALIGN_CENTER).set_background_colour(Wx::BLUE) Wx::StaticText.new(self, -1, "align right", Wx::Point.new(220, 70), Wx::Size.new(90, -1), Wx::ALIGN_RIGHT).set_background_colour(Wx::BLUE) str = "This is a different font." text = Wx::StaticText.new(self, -1, str, Wx::Point.new(20, 100)) font = Wx::Font.new(18, Wx::SWISS, Wx::NORMAL, Wx::NORMAL) text.set_font(font) #text.set_size(text.get_best_size()) Wx::StaticText.new(self, -1, "Multi-line Wx::StaticText\nline 2\nline 3\n\nafter empty line", Wx::Point.new(20,150)) Wx::StaticText.new(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", Wx::Point.new(220,150), Wx::DEFAULT_SIZE,Wx::ALIGN_RIGHT) end end module Demo def Demo.run(frame,nb,log) panel = TestPanel.new(nb) return panel end def Demo.overview "A static text control displays one or more lines of read-only text." end end if __FILE__ == $0 run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb') load run_solo_lib run File.basename($0) end
Version data entries
4 entries across 4 versions & 1 rubygems