[Tutor] Bitmaps and TK

alan.gauld@bt.com alan.gauld@bt.com
Wed Dec 4 12:55:02 2002


> but I just cannot get a full colour picture to appear on a 
> canvas at an X,Y position specified by me

Caveat, I have no experience of using images within canvases...

> import Image
> from Tkinter import *
> root = Tk()
> root.title('Canvas')
> Image.open ("C:\\Python_projects\\CRAP\\topleftcorner.bmp")
> canvas = Canvas(root, width =720, height=576, bg="#ff0000")

This seems odd to me. Surely you want to put the canvas inside 
a Frame, not...

> canvas.create_polygon(100, 100, 200, 100, 200, 200, 100, 200, 
> fill='yellow')
> #not sure what this next line should look like
> #canvas.create_image (64, 50, image=im)
> frm = Frame(canvas, borderwidth=0)

...a frame inside a canvas?

If you reverse the parenting of these objects does that help?

> canvas.create_window(720, 576, window=frm, anchor=CENTER)
> canvas.pack()
> root.mainloop()

But just a guess...

Alan g
(With an amazingly bad track record this week...)