after many difficulties i managed to get in the
text widget both an image and scrollbars.
I cannot find a way to scroll my image !!!
any help is welcomed
hereafter is my code
**********
#scrollbars
text .t -yscrollcommand {.s set}
scrollbar .s -command {.t yview}
pack .s -side right -fill y
pack .t -expand yes -fill both
#enabling jpeg
package require Img
#going to the image directory
cd C:/tmp/venise
#getting the image
set im [image create photo im -file 04.jpg]
#inserting image
.t image create end -image im
*******************
thank you
jerome
On 29 Apr 2006 13:21:05 -0700, "Aric Bills" <aric....@gmail.com>
wrote:
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....@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|
+------------------------------------------------------------------------+
I agree with Gerald, a canvas is probably the best way to allow users
to scroll an image.
You mentioned that the Tclkit you downloaded didn't have the Img
package. For what it's worth, you can use your current copy of Img
(and other Tcl extensions on your computer) with your new tclkit. When
you fire it up, just add the directory/directories where the extensions
live to the global variable $::auto_path. Something like:
lappend auto_path C:/tcl/lib
Then each time you call [package require], it will look in C:/tcl/lib
as well as any other directory in $auto_path.
On 29 Apr 2006 16:46:32 -0700, "Aric Bills" <aric....@gmail.com>
wrote:
>I should have clarified in my earlier posting, the scrolling behavior
You should already have the Img package from your ActiveTcl 8.4
install. Use it.
--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
Use the environment variable TCLLIBPATH to accomplish the same thing
with no need to hack the code itself.
On Sat, 29 Apr 2006 18:15:30 -0500, "Gerald W. Lester"
<Gerald...@cox.net> wrote:
On 29 Apr 2006 16:46:32 -0700, "Aric Bills" <aric....@gmail.com>
wrote:
>I should have clarified in my earlier posting, the scrolling behavior