Hi Michael, Francis,

Michael, if you change the bg of the canvases, you
will see that Francis is right, the canvas extends
past the edge of the photo image.
I changed his code as follows adding the bg atributes:

panel1 = tk.Canvas(root, bg="red")
panel1.grid(row=0, column=0, sticky=tk.NSEW)
panel2 = tk.Canvas(root, bg="blue")

Francis, this behaviour is all as expected. A canvas does not
adjust its size to its contents (the jpg). It opens with a default size.
What you probably want to do is resize the canvas once the jpg is drawn.
For instance, add these lines (or some subset) at the end of openImage:

        panel1['height']=h
        panel1['width']=w
        panel2['height']=h
        panel2['width']=w

Mick



On Thu, Oct 22, 2009 at 10:24 PM, Michael Lange <klappn...@web.de> wrote:
> Hi,
>
> On Thu, 22 Oct 2009 08:46:19 -0700 (PDT)
> buckr02 <francis_ryan...@hotmail.com> wrote:
>
> (...)
>>
>> I am having trouble with the images, however, as they are being cut
>> off (only part of the image is being shown).  I am using Canvas
>> objects to hold the images.
>>
>> I was able to throw in a few lines to fix most of the problems, but
>> since it isn't perfect, I'd like to get to the bottom of it.  The
>> only noticeable problem left is that if you load a vertical picture,
>> there is space left to the right of the image that is counted as part
>> of the canvas.  I uploaded the Python code and an image which
>> demonstrates the problem.
>>
>> http://www.nabble.com/file/p26012393/ForUpload.py ForUpload.py
>> http://www.nabble.com/file/p26012393/DSC_1108.JPG DSC_1108.JPG
>> --
>
> I don't see anything that's wrong with the images here, except that
> there's a 1- or 2- pixel gray border around the images. If this is what
> you mean, you can probably get rid of it by specifying
> bd=0, highlightthickness=0 in the Canvas constructors.
>
> HTH
>
> Michael
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to