code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
# Create the tabnotebook widget and pack it.
tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
:side=>:top, :padx=>10, :pady=>0)
# Add two pages to the tabnotebook,
# labelled "Page One"... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5,
:fixed=>true, :range=>[32, 212]).pack(:pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
#########################################################
#
# set Tk.encoding = 'utf-8' for a utf8 charecter
#
#########################################################
require 'tk'
require 'tkextlib/iwidgets'
Tk.encoding = 'utf-8'
TkOption.add('*textBackground', 'white')
ef = Tk::Iwidgets::Ent... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Spintime.new.pack(:padx=>10, :pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10,
:fill=>:both, :expand=>true)
sb.insert_items('end', *['Hello', 'Out There', 'World'])
TkLabel.new(sb.child_sit... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Spindate.new.pack(:padx=>10, :pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
# Create the tabnotebook widget and pack it.
nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
:side=>:top, :padx=>10, :pady=>0)
# Add two pages to the tabnotebook,
# labelled "Page One" an... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
ds = Tk::Iwidgets::Dialogshell.new(:modality=>:none)
ds.add('OK', :text=>'OK', :command=>proc{puts 'OK'; ds.deactivate})
ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate})
ds.default('OK')
TkButton.new(:text=>'ACTIVATE', :padx=... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true,
:padx=>10, :pady=>10)
djl.set_lhs(*[0,2,4,5])
djl.set_rhs(3,6)
djl.insert_lhs(1,7,8)
djl.insert_rhs(9)
p djl.get_lhs
p djl.get_rhs
Tk.m... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
lf = Tk::Iwidgets::Labeledframe.new(:labeltext=>'Entry Frame', :labelpos=>:n)
lf.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10)
cs = lf.child_site
Tk::Iwidgets::Entryfield.new(cs, :labeltext=>'Name:').pack(:side=>:top, :fill=>:x)
Tk::Iwidgets::Spi... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
class Spinner_demo < TkWindow
Months = %w(January February March April May June July August September October November December)
def block_input(c)
false
end
def spin_month(step)
index = Months.index(@spinner.get) + step
index = 11 if i... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
sh = Tk::Iwidgets::Shell.new(:modality=>:application,
:padx=>20, :pady=>20, :title=>'Shell')
TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
:command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10)
TkLabel.... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
# sample 1
p bb1 = Tk::Iwidgets::Buttonbox.new
p bb1.add('Yes', :text=>'Yes', :command=>proc{puts 'Yes'})
p bb1.add('No', :text=>'No', :command=>proc{puts 'No'})
p bb1.add('Maybe', :text=>'Maybe', :command=>proc{puts 'Maybe'})
bb1.default('Yes')
bb... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
tf = Tk::Iwidgets::Timefield.new(:command=>proc{puts(tf.get)})
tf.pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
mainloop = Thread.new{Tk.mainloop}
st = Tk::Iwidgets::Scrolledtext.new.pack
st.insert('end', "Now is the time for all good men\n")
st.insert('end', "to come to the aid of their country")
fd = Tk::Iwidgets::Finddialog.new(:textwidget=>st)
fd.center(st)
fd.a... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Thread.new{Tk.mainloop}
d = Tk::Iwidgets::Dialog.new(:modality=>:application)
d.buttonconfigure('OK', :command=>proc{puts 'OK'; d.deactivate true})
d.buttonconfigure('Apply', :command=>proc{puts 'Apply'})
d.buttonconfigure('Cancel', :command=>proc{puts 'Ca... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
mainloop = Thread.new{Tk.mainloop}
TkOption.add('*textBackground', 'white')
pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password',
:labeltext=>'Password:', :show=>'*')
pd.hide('Apply')
if TkComm.boo... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget',
:labelpos=>:s)
lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10)
cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200,
... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Timeentry.new.pack
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Pushbutton.new(:text=>'Hello',
:command=>proc{puts 'Hello World'},
:defaultring=>true).pack(:padx=>10, :pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300)
pw.add('top')
pw.add('middle', :margin=>10)
pw.add('bottom', :margin=>10, :minimum=>10)
pw.pack(:fill=>:both, :expand=>true)
pw.child_site_list.each{|pane|
TkButton.new(pane, :text=>pane.path... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10,
:fill=>:both, :expand=>true)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
# Create the tabnotebook widget and pack it.
nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
:side=>:left, :padx=>10, :pady=>10)
# Add two pages to the tabnotebook,
# labelled "Page One" ... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
sc = Tk::Iwidgets::Scrolledcanvas.new
sc.create(TkcRectangle, 100, 100, 400, 400, :fill=>'red')
TkcRectangle.new(sc, 300, 300, 600, 600, :fill=>'green')
TkcRectangle.new(sc, [[200, 200], [500, 500]], :fill=>'blue')
sc.pack(:expand=>true, :fill=>:both, :pad... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
helpvar = TkVariable.new
viewmode = TkVariable.new
mb = Tk::Iwidgets::Menubar.new
mb.menubuttons = [
[:menubutton, 'file', {
:text=>'File', :menu=>[
[:command, 'new', {:label=>'New'}],
[:command, 'close', {:label=>'Close'}],
... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Thread.new{
trap('INT') {puts 'catch SIGINT'}
sleep 5
trap('INT', 'DEFAULT')
}
Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no,
:width=>155, :height=>155){|w|
w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
mw = Tk::Iwidgets::Mainwindow.new
mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0,
:padx=>8, :pady=>2, :menu=>[
[:options, {:tearoff=>false}],
[:command, 'new', {
:label... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
cb = Tk::Iwidgets::Checkbox.new
cb.add('bold', :text=>'Bold')
cb.add('italic', :text=>'Italic')
cb.add('underline', :text=>'Underline')
cb.select('underline')
cb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
#########################################################
#
# use Tk::UTF8_String() for a utf8 charecter
#
#########################################################
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
ef = Tk::Iwidgets::Entryfield.new(:command=>proc{... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
rb = Tk::Iwidgets::Radiobox.new(:labeltext=>'Fonts')
rb.add('times', :text=>'Times')
rb.add('helvetica', :text=>'Helvetica')
rb.add('courier', :text=>'Courier')
rb.add('symbol', :text=>'Symbol')
rb.select('courier')
rb.pack(:expand=>true, :fill=>:bo... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
mainloop = Thread.new{Tk.mainloop}
#
# Non-modal example
#
nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal')
nmfsd.buttonconfigure('OK', :command=>proc{
puts "You selected #{nmfsd.get}"
nmfsd.... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
pw = Tk::Iwidgets::Panedwindow.new(:width=>300, :height=>300)
top = pw.add
middle = pw.add(:margin=>10)
bottom = pw.add(:margin=>10, :minimum=>10)
pw.pack(:fill=>:both, :expand=>true)
pw.child_site_list.each{|pane|
TkButton.new(pane, :text=>pane.path, :... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
# Create a listbox with two items (one and two)
l = TkListbox.new(:selectmode=>:single, :exportselection=>false).pack
l.insert('end', 'one')
l.insert('end', 'two')
l.selection_set(0)
# Define a proc that knows how to select an item
# from a list given an in... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10,
:fill=>:both, :expand=>true)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Canvasprintbox.new(:orient=>:landscape, :stretch=>1) \
.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
mainloop = Thread.new{Tk.mainloop}
dir = '/usr/local/ActiveTcl/demos/IWidgets/html/'
href = [ 'hyperhelp.n', 'buttonbox.n', 'calendar.n' ]
hh = Tk::Iwidgets::Hyperhelp.new(:topics=>href, :helpdir=>dir)
hh.show_topic('hyperhelp.n')
hh.activate
mainloop.jo... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info',
:background=>'bisque', :activeforeground=>'red',
:bitmapforeground=>'blue', :defaultring=>true,
:comman... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single,
:vscrollmode=>:static,
:hscrollmode=>:dynamic,
... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica',
:linkcommand=>proc{|href|
sh.import_link(href)
... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)},
:weekendbackground=>'mistyrose',
:weekdaybackground=>'ghostwhite',
:outline=>'black', :startday=>'wednesday',
... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'
om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w,
:labeltext=>"Operating System :")
om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS')
om.sort_ascending
om.select('Linux')
om.pack(:padx=>... | Ruby |
#!/usr/bin/ruby
require 'tk'
require 'tkextlib/tcllib/datefield'
require 'parsedate'
Tk.root.title('Datefield example')
my_date1 = TkVariable.new
my_date2 = TkVariable.new
my_date1.trace('w'){
begin
t = Time.local(*(ParseDate.parsedate(my_date1.value)))
my_date2.value = t.strftime('%A')
rescue
# ign... | Ruby |
#!/usr/bin/ruby
require 'tk'
require 'tkextlib/tcllib/plotchart'
###############################
c1 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
c2 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
c3 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
Tk.pack(c1,c2,c3, :... | Ruby |
#!/usr/bin/ruby
require 'tk'
require 'tkextlib/tcllib/plotchart'
TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c|
pack(:fill=>:both)
Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0],
[0.0, 100.0, 20.0]){
[ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], ... | Ruby |
#!/usr/bin/ruby
require 'tk'
require 'tkextlib/tcllib/plotchart'
###############################
# Set up a strip chart
###############################
Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0],
[0.0, 100.0, 20.0],
:background... | Ruby |
#!/usr/bin/ruby
require 'tk'
require 'tkextlib/tcllib/plotchart'
###############################
c1 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
c2 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
Tk.pack(c1,c2, :fill=>:both, :side=>:top)
###############################
# Set up a ... | Ruby |
#
# select demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoSelect
@@var = TkVariable.new_hash
def self.create(nb)
frame = nb.insert('end', 'demoSelect', :text=>'Spin & Combo... | Ruby |
#
# basic demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoBasic
@@var = TkVariable.new_hash
@@after = nil
@@count = 0
def self.create(nb)
frame = nb.insert('end', 'dem... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/bwidget'
module DemoVar
@_wfont = nil
@notebook = nil
@mainframe = nil
@status = TkVariable.new
@prgtext = TkVariable.new
@prgindic = TkVariable.new
@font = nil
@font_name = nil
@toolbar1 = TkVariable.new(true)
@toolbar2 = TkVariab... | Ruby |
#
# templdlg demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoDialog
@@tmpl = TkVariable.new_hash
@@msg = TkVariable.new_hash
@@msgdlg = nil
@@progmsg = TkVari... | Ruby |
#
# manager demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoManager
@@progress = TkVariable.new(false)
@@status = TkVariable.new('Compute in progress...')
@@homogeneous... | Ruby |
#
# dnd demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoDnD
def self.create(nb)
frame = nb.insert('end', 'demoDnD', :text=>'Drag and Drop')
titf1 = Tk::BWidget::TitleFrame... | Ruby |
#
# templdlg demo --- called from demo.rb
#
unless Object.const_defined?('DemoVar')
fail RuntimeError, "This is NOT a stand alone script. This script is called from 'demo.rb'. "
end
module DemoTree
@@count = 0
@@dblclick = false
@@top = nil
def self.create(nb)
frame = nb.insert('end', 'demoTree', :te... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
length = 250000
graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
graph.yaxis_configure(:title=>'Y Axis Label')
graph.legend_configure(:activerelief=>:sunken, :background=>'')
Tk::BL... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
file = File.join(File.dirname(File.expand_path(__FILE__)),
'images', 'buckskin.gif')
bgTexture = TkPhotoImage.new(:file=>file)
TkOption.add('*Graph.Tile', bgTexture)
TkOption.add('*Label.Tile', bgTexture)
TkOption.add('*Frame.Tile', bgTexture)
T... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
graph = Tk::BLT::Graph.new.pack
plot = Tk::BLT::PlotComponent::Element.new(graph, :linewidth=>0, :label=>'foo')
plot.data([[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
load File.join(File.dirname(File.expand_path(__FILE__)),
'scripts', 'stipples.rb')
TkOption.add('*graph.x.Title', 'X Axis Label')
TkOption.add('*graph.y.Title', 'Y Axis Label')
TkOption.add('*graph.title', 'A Simple Barchart')
TkOption.add('*graph... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
length = 250000
graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
graph.yaxis_configure(:title=>'Y Axis Label')
graph.legend_configure(:activerelief=>:sunken, :background=>'')
Tk::BL... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
file = File.join(File.dirname(File.expand_path(__FILE__)),
'images', 'qv100.t.gif')
if File.exist?(file)
src = TkPhotoImage.new(:file=>file)
else
fail RuntimeError, 'no image file'
end
width = src.width
height = src.height
TkOption.add('*La... | Ruby |
$stipples = {} unless $stipples
$stipples['bdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
#define bdiagonal1_width 8
#define bdiagonal1_height 8
static unsigned char bdiagonal1_bits[] = {
0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};
EOD
$stipples['bdiagonal2'] = Tk::BLT::Bitmap.new(<<EOD)
#define bdiagonal2_width 8... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
graph = Tk::BLT::Graph.new.pack
plot = graph.element_create
plot.configure(:linewidth=>0, :label=>'foo',
:data=>[[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
file = File.join(File.dirname(File.expand_path(__FILE__)),
'images', 'sample.gif')
if File.exist?(file)
src = TkPhotoImage.new(:file=>file)
else
fail RuntimeError, 'no image file'
end
width = src.width
height = src.height
TkOption.add('*Lab... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
length = 250000
graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
graph.yaxis_configure(:title=>'Y Axis Label')
graph.legend_configure(:activerelief=>:sunken, :background=>'')
Tk::BL... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
# Example of a pareto chart.
#
# The pareto chart mixes line and bar elements in the same graph.
# Each processing operating is represented by a bar element. The
# total accumulated defects is displayed with a single line element.
b = Tk::BLT::Barchart.new(:tit... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
Tk::TCL_PRECISION.value = 15
[
['*Graph.Width', '10i'],
['*Graph.leftMargin', '.75i'],
['*Graph.Height', '6i'],
['*Graph.plotBackground', 'black'],
['*LineMarker.color', 'white'],
['*LineMarker.Dashes', 5],
['*TextMarker.foreground', 'white'],
[... | Ruby |
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/blt'
require 'date'
dir = File.join(File.dirname(File.expand_path(__FILE__)), 'images')
file = File.join(dir, 'chalk.gif')
active = File.join(dir, 'rain.gif')
texture1 = TkPhotoImage.new(:file=>file)
texture2 = TkPhotoImage.new(:file=>active)
TkOption.add('*Tile',... | Ruby |
#!/usr/bin/env ruby
#
# This script implements the "hv" application. Type "hv FILE" to
# view FILE as HTML.
#
# This application is used for testing the HTML widget. It can
# also server as an example of how to use the HTML widget.
#
require 'tk'
require 'tkextlib/tkHTML'
root = TkRoot.new(:title=>'HTML File Viewer'... | Ruby |
#!/usr/bin/env ruby
#
# This script implements the "ss" application. "ss" implements
# a presentation slide-show based on HTML slides.
#
require 'tk'
require 'tkextlib/tkHTML'
file = ARGV[0]
class TkHTML_File_Viewer
include TkComm
# These are images to use with the actual image specified in a
# "<img>" markup can... | Ruby |
# plot.rb
#
# This demonstration script creates a canvas widget showing a 2-D
# plot with data points that can be dragged with the mouse.
#
# 2-D plot widget demo (called by 'widget')
#
# toplevel widget
if defined?($plot_demo) && $plot_demo
$plot_demo.destroy
$plot_demo = nil
end
# demo toplevel widget
$plot_dem... | Ruby |
# twind.rb
#
# This demonstration script creates a text widget with a bunch of
# embedded windows.
#
# text (embedded windows) widget demo (called by 'widget')
#
# toplevel widget
if defined?($twind_demo) && $twind_demo
$twind_demo.destroy
$twind_demo = nil
end
# demo toplevel widget
$twind_demo = TkToplevel.new ... | Ruby |
# entry2.rb
#
# This demonstration script is the same as the entry1.tcl script
# except that it creates scrollbars for the entries.
#
# entry (with scrollbars) widget demo (called by 'widget')
#
# toplevel widget
if defined?($entry2_demo) && $entry2_demo
$entry2_demo.destroy
$entry2_demo = nil
end
# demo toplevel... | Ruby |
#
# text (embedded windows) widget demo 2 (called by 'widget')
#
# delete toplevel widget
if defined?($twind2_demo) && $twind2_demo
$twind2_demo.destroy
$twind2_demo = nil
end
# demo toplevel widget
$twind2_demo = TkToplevel.new {|w|
title("Text Demonstration - Embedded Windows 2")
iconname("Embedded Windows"... | Ruby |
#
# animated wave demo (called by 'widget')
#
# based on Tcl/Tk8.5a2 widget demos
# destroy toplevel widget for this demo script
if defined?($aniwave_demo) && $aniwave_demo
$aniwave_demo.destroy
$aniwave_demo = nil
end
# create toplevel widget
$aniwave_demo = TkToplevel.new {|w|
title("Animated Wave Demonstrati... | Ruby |
# vscale.rb
#
# This demonstration script shows an example with a vertical scale.
require "tkcanvas"
if defined?($vscale_demo) && $vscale_demo
$vscale_demo.destroy
$vscale_demo = nil
end
$vscale_demo = TkToplevel.new {|w|
title("Vertical Scale Demonstration")
iconname("vscale")
}
positionWindow($vscale_demo)... | Ruby |
#
# text widget peering demo (called by 'widget')
#
# based on Tcl/Tk8.5.0 widget demos
if defined?($textpeer_demo) && $textpeer_demo
$textpeer_demo.destroy
$textpeer_demo = nil
end
# demo toplevel widget
$textpeer_demo = TkToplevel.new {|w|
title("Text Wdget Peering Demonstration")
iconname("textpeer")
pos... | Ruby |
#
# entry (no scrollbars) widget demo (called by 'widget')
#
# toplevel widget
if defined?($entry1_demo) && $entry1_demo
$entry1_demo.destroy
$entry1_demo = nil
end
# demo toplevel widget
$entry1_demo = TkToplevel.new {|w|
title("Entry Demonstration (no scrollbars)")
iconname("entry1")
positionWindow(w)
}
... | Ruby |
#!/usr/bin/env ruby
# rmt --
# This script implements a simple remote-control mechanism for
# Tk applications. It allows you to select an application and
# then type commands to that application.
require 'tk'
class Rmt
def initialize(parent=nil)
win = self
unless parent
parent = TkRoot.new
end
... | Ruby |
#!/usr/bin/env ruby
#
# ixset --
# A nice interface to "xset" to change X server settings
#
require 'tk'
class Xsettings
#
# Button actions
#
def quit
@root.destroy
end
def ok
writesettings
quit
end
def cancel
readsettings
dispsettings
@btn_APPLY.state(:disabled)
@btn_CAN... | Ruby |
# radio.rb
#
# This demonstration script creates a toplevel window containing
# several radiobutton widgets.
#
# radiobutton widget demo (called by 'widget')
#
# toplevel widget
if defined?($radio_demo) && $radio_demo
$radio_demo.destroy
$radio_demo = nil
end
# demo toplevel widget
$radio_demo = TkToplevel.new {|... | Ruby |
#
# a dialog box with a global grab (called by 'widget')
#
class TkDialog_Demo2 < TkDialog
###############
private
###############
def title
"Dialog with global grab"
end
def message
"This dialog box uses a global grab, so it prevents you from interacting with anything on your display until you inv... | Ruby |
# Based on the widget demo of Tcl/Tk8.5.2
# The following is the original copyright text.
#----------------------------------------------------------------------------
# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Calculate a Knight's tour of a chessboard.
#
# This uses Warnsdorff's rule to calc... | Ruby |
# sayings.rb
#
# This demonstration script creates a listbox that can be scrolled
# both horizontally and vertically. It displays a collection of
# well-known sayings.
#
# listbox widget demo 'sayings' (called by 'widget')
#
# toplevel widget
if defined?($sayings_demo) && $sayings_demo
$sayings_demo.destroy
$sayi... | Ruby |
#!/usr/bin/env ruby
# browse --
# This script generates a directory browser, which lists the working
# directory and allow you to open files or subdirectories by
# double-clicking.
require 'tk'
# Create a scrollbar on the right side of the main window and a listbox
# on the left side.
listbox = TkListbox.new(nil, '... | Ruby |
# colors.rb
#
# This demonstration script creates a listbox widget that displays
# many of the colors from the X color database. You can click on
# a color to change the application's palette.
#
# listbox widget demo 'colors' (called by 'widget')
#
# toplevel widget
if defined?($colors_demo) && $colors_demo
$colors... | Ruby |
# msgbox.rb
#
# This demonstration script creates message boxes of various type
#
# message boxes widget demo (called by 'widget')
#
# toplevel widget
if defined?($msgbox_demo) && $msgbox_demo
$msgbox_demo.destroy
$msgbox_demo = nil
end
# demo toplevel widget
$msgbox_demo = TkToplevel.new {|w|
title("Message Bo... | Ruby |
# unicodeout.rb --
#
# This demonstration script shows how you can produce output (in label
# widgets) using many different alphabets.
#
# based on Tcl/Tk8.4.4 widget demos
if defined?($unicodeout_demo) && $unicodeout_demo
$unicodeout_demo.destroy
$unicodeout_demo = nil
end
$unicodeout_demo = TkToplevel.new {|w|
... | Ruby |
# toolbar.rb --
#
# This demonstration script creates a toolbar that can be torn off.
#
# based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp"
if defined?($toolbar_demo) && $toolbar_demo
$toolbar_demo.destroy
$toolbar_demo = nil
end
$toolbar_demo = TkToplevel.new {|w|
title("Ttk Menu Buttons")
iconnam... | Ruby |
# floor.rb
#
# This demonstration script creates a canvas widet that displays the
# floorplan for DEC's Western Research Laboratory.
#
# floorDisplay widget demo (called by 'widget')
#
# floorDisplay --
# Recreate the floorplan display in the canvas given by "w". The
# floor given by "active" is displayed on top with... | Ruby |
# filebox.rb
#
# This demonstration script prompts the user to select a file.#
# widget demo prompts the user to select a file (called by 'widget')
#
# toplevel widget
if defined?($filebox_demo) && $filebox_demo
$filebox_demo.destroy
$filebox_demo = nil
end
# demo toplevel widget
$filebox_demo = TkToplevel.new {|... | Ruby |
# check.rb
#
# This demonstration script creates a toplevel window containing
# several checkbuttons.
#
# checkbutton widget demo (called by 'widget')
#
# toplevel widget
if defined?($check_demo) && $check_demo
$check_demo.destroy
$check_demo = nil
end
# demo toplevel widget
$check_demo = TkToplevel.new {|w|
ti... | Ruby |
#
# This demonstration illustrates how Tcl/Tk can be used to construct
# simulations of physical systems.
# (called by 'widget')
#
# based on Tcl/Tk8.5a2 widget demos
# destroy toplevel widget for this demo script
if defined?($pendulum_demo) && $pendulum_demo
$pendulum_demo.destroy
$pendulum_demo = nil
end
# crea... | Ruby |
# ctext.rb
#
# This demonstration script creates a canvas widget with a text
# item that can be edited and reconfigured in various ways.
#
# Canvas Text widget demo (called by 'widget')
#
# toplevel widget
if defined?($ctext_demo) && $ctext_demo
$ctext_demo.destroy
$ctext_demo = nil
end
# demo toplevel widget
$ct... | Ruby |
# icon.rb
#
# This demonstration script creates a toplevel window containing
# buttons that display bitmaps instead of text.
#
# iconic button widget demo (called by 'widget')
#
# toplevel widget
if defined?($icon_demo) && $icon_demo
$icon_demo.destroy
$icon_demo = nil
end
# demo toplevel widget
$icon_demo = TkTo... | Ruby |
# arrow.rb
#
# This demonstration script creates a canvas widget that displays a
# large line with an arrowhead whose shape can be edited interactively.
#
# arrowhead widget demo (called by 'widget')
#
# arrowSetup --
# This method regenerates all the text and graphics in the canvas
# window. It's called when the can... | Ruby |
# radio3.rb
#
# This demonstration script creates a toplevel window containing
# several radiobutton widgets.
#
# radiobutton widget demo (called by 'widget')
#
# toplevel widget
if defined?($radio3_demo) && $radio3_demo
$radio3_demo.destroy
$radio3_demo = nil
end
# demo toplevel widget
$radio3_demo = TkToplevel.... | Ruby |
#
# form widget demo (called by 'widget')
#
# toplevel widget
if defined?($form_demo) && $form_demo
$form_demo.destroy
$form_demo = nil
end
# demo toplevel widget
$form_demo = TkToplevel.new {|w|
title("Form Demonstration")
iconname("form")
positionWindow(w)
}
base_frame = TkFrame.new($form_demo).pack(:fil... | Ruby |
#!/usr/bin/env ruby
require 'tk'
#unless /^8\.[1-9]/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK
# require 'tkencoding'
#end
TkButton.new(nil,
'text'=>"Hello Ruby world!",
'font'=>TkFont.new('k14'),
'command'=>proc{print "Hello Ruby world!\n"; exit}
).pack
Tk.mainloop
| Ruby |
#!/usr/bin/env ruby
# ixset --
# A nice interface to "xset" to change X server settings
#
require 'tk'
class Xsettings
#
# Button actions
#
def quit
@root.destroy
end
def ok
writesettings
quit
end
def cancel
readsettings
dispsettings
end
# apply is just "writesettings"
... | Ruby |
#!/usr/bin/env ruby
#
# timer --
# This script generates a counter with start,stop and reset buttons.
#
# Copyright (C) 1998 Takaaki Tateishi (ttate@jaist.ac.jp)
# last update: Sat Jun 27 12:24:14 JST 1998
#
require "tk"
require "thread"
require "tkafter"
$time = "0.00"
$m = Mutex.new
$loop = false
def timer_stop
... | Ruby |
# msgbox2.rb
#
# This demonstration script creates message boxes of various type
#
# message boxes widget demo (called by 'widget')
#
# toplevel widget
if defined?($msgbox2_demo) && $msgbox2_demo
$msgbox2_demo.destroy
$msgbox2_demo = nil
end
# demo toplevel widget
$msgbox2_demo = TkToplevel.new {|w|
title("Mess... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.