Scrollable TkCanvas code

There’s an example in the Pickaxe of using scrollbars with with a
TkListbox, but I need a scrolling TkCanvas and it doesn’t seem to work
quite the same. Specifically, I can’t seem to get the size of the
scrollbar to change based the range of the canvase (I’m using scale to
zoom in and out).

Does anyone have any example code which does this sort of thing which they
could share?

Thanks.

Phil

Hi!

···

On Tue, May 27, 2003 at 04:24:46PM +0900, Phil Tomson wrote:

There’s an example in the Pickaxe of using scrollbars with with a
TkListbox, but I need a scrolling TkCanvas and it doesn’t seem to work
quite the same. Specifically, I can’t seem to get the size of the
scrollbar to change based the range of the canvase (I’m using scale to
zoom in and out).

Does anyone have any example code which does this sort of thing
which they could share?

Theres a nice Tk FAQ/Howto:

http://httpd.chello.nl/k.vangelder/ruby/learntk/scrollbars.html


chris

In article 20030527080423.GB26052@aiss.de,

Hi!

There’s an example in the Pickaxe of using scrollbars with with a
TkListbox, but I need a scrolling TkCanvas and it doesn’t seem to work
quite the same. Specifically, I can’t seem to get the size of the
scrollbar to change based the range of the canvase (I’m using scale to
zoom in and out).

Does anyone have any example code which does this sort of thing
which they could share?

Theres a nice Tk FAQ/Howto:

http://httpd.chello.nl/k.vangelder/ruby/learntk/scrollbars.html

Thanks. I tool a look at their example, but my situation is a bit
different, I think, but maybe someone can explain the difference:

In the Tutorial example they start out with a Canvas which has fixed
dimensions:

canvas = TkCanvas.new(root, ‘width’=>320, ‘height’=>200).pack(‘fill’=>‘both’,
‘expand’=>true)

In my case, I don’t specify a width since I want the width to adjust as
the window is expanded. So I do:

@canvas = TkCanvas.new(@frame)
@canvas.configure  'height'=> 20
@canvas.pack('side'=>'left', 'fill'=>'x', 'expand'=> true)

Perhaps I should go ahead and specify a width in @canvas.configure?

Phil

···

Christian von Mueffling cvm@aiss.de wrote:

On Tue, May 27, 2003 at 04:24:46PM +0900, Phil Tomson wrote: