More tk stuff

  • Thread starter Kenneth McDonald
  • Start date
K

Kenneth McDonald

OK, I dug up an answer to my previous question; here's code to
implement a window with scrollbars:

require 'tk'

root = TkRoot.new() { title "(Sc)rolling, (sc)rolling),
(sc)rolling..." }
xbar = TkScrollbar.new(root, 'orient'=>'h').pack('side'=>'bottom',
'fill'=>'x')
ybar = TkScrollbar.new(root, 'orient'=>'v').pack('side'=>'right',
'fill'=>'y')
text = TkText.new(root, 'wrap'=>'none',
'width'=>20).pack('fill'=>'both', 'expand'=>true)
text.insert('end', "A string that is longer than fits on one line...")
xbar.command(proc {|*args| text.xview(*args)})
text.xscrollcommand(proc {|first, last| xbar.set(first, last)})
ybar.command(proc {|*args| text.yview(*args)})
text.yscrollcommand(proc {|first, last| ybar.set(first, last)})

Tk.mainloop


Next question; how does one access the new 'themed' widgets in the
modern releases of Tk? Something like ttk::entry, I mean; I assume the
double colon wouldn't be used in Ruby (and I certainly couldn't get it
to work.)

Thanks,
Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Trying to get back into Tk 1
ruby/tk - getting started 2
Ruby/Tk 4
Ruby/tk Help Please 19
Ruby TK 2
Tk and Tile with Tk8.5 9
[RFC] framework of Ruby/Tk + VNC 0
Ruby/Tk 10

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top