From: Jim I. <ji...@ap...> - 2003-12-16 01:05:26
|
There are a couple of things to do here. One is to just set the width and height of the canvas to the required size. So, after the "create image" line do: .tk_draw_canvas configure -height 640 -width 1265 This will reset the windows size appropriately. Note, however, that if the user has resized the window before you set this, then the window won't resize itself. If you want to force the window size, do: wm geometry . 1024x640 But it is considered a little impolite to resize a window out from under the user if they have made it smaller. It might be better to provide scrollbars and just resize the canvas. Then if they haven't messed with the size, it will grow to fit. Otherwise they can scroll it around. But I don't know what you are building... Jim On Dec 15, 2003, at 1:51 PM, Michael Norton wrote: > hi, > > I have the following script which I load in a gif file that is 1265 x > 640. Once I load the file I was curious as to how I adjust the canvas > to the size of the file. > > Do I need to use the command wm geometry? If so how do I do this using > this script? > > thanks. > > Mike > > > package require Img > > set tk_draw_height 200 > set tk_draw_width 200 > > canvas .tk_draw_canvas -height $tk_draw_height -width $tk_draw_width \ > -background white > pack .tk_draw_canvas > > set filename "test_photo.gif" > puts $filename > > set imagename $filename > set imh [image create photo $imagename -file $filename] > > .tk_draw_canvas create image 0 0 -image $imagename > .tk_draw_canvas itemconfigure -image $imagename > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Tcl-mac mailing list > Tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > -- Jim Ingham ji...@ap... Developer Tools Apple Computer |