Re: help image scrolling
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: help image scrolling

From: Gerald W. Lester <Gerald.Lester@cox.net>
Date: Sun Apr 30 2006 - 01:15:30 CEST

suchodj@wanadoo.fr wrote:
> Hello Aric
> i downloaded Tcl/Tk 8.5a4 from http://www.equi4.com/pub/tk/8.5a4/.
> As you said it works fine. Since it has not the package "Img" i had
> to convert my picture from "jpg" to "gif". Many thanks.
> One more question please :
> supposing there is no Tcl/Tk 8.5.x and i have only Tcl/Tk 8.4.x
> how can i visualize pictures and scroll them horizontal and vertical ?
> thanks in advance

Prior to 8.5, text widgets minimum scrolling was a line at a time.

Try a canvas widget instead, as in:

        package require image

        scrollbar .hsb -orient horizontal -command [list .c xview]
        scrollbar .vsb -orient vertical -command [list .c yview]
        canvas .c \
            -xscrollcommand [list .hsb set] \
            -yscrollcommand [list .vsb set]
        grid .c -row 1 -column 1 -sticky nsew
        grid .vsb -row 1 -column 2 -sticky ns
        grid .hsb -row 2 -column 1 -sticky ew
        grid columnconfigure . 1 -weight 1
        grid rowconfigure . 1 -weight 1

        set im [image create photo im -file {04.jpg}

        .c create image 0 0 -image im
        .c configure -scrollregion [.c bbox all]

> jerome
>
>
>
> On 29 Apr 2006 13:21:05 -0700, "Aric Bills" <aric.bills@gmail.com>
> wrote:
>
>> Scrolling has been enhanced in Tk 8.5. If you use the ActiveTcl 8.5
>> beta, an 8.5 tclkit, or some other incarnation of Tcl 8.5, your code
>> should work okay.
>

-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester                                                       |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Received on Sun Apr 30 03:32:02 2006