[Tutor] Displaying .GIF file on a canvas

Henry Steigerwaldt hsteiger@comcast.net
Mon, 02 Sep 2002 01:10:03 -0500


This is a multi-part message in MIME format.

--Boundary_(ID_S58WlvxoZciU2hQLq9cQqg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

To All:

Can anyone tell me what is wrong with this code? I am 
simply trying to display a .GIF file on a canvas. The canvas
is placed on a toplevel window (root). 

No errors occur, but yet the .GIF file never appears on the 
canvas. 

I have played around with this thing for probably 30 
minutes or longer without any success. 

Below is the code snipet:
_________________________________
root = Tk()

root.geometry('1024x768+125+100')

canvas = Canvas(root, width=950, height=700)

img = PhotoImage(file = '\\python_pgms\\plot_guidance\\guid_map.gif') 

canvas.create_image(600,400, image=img, anchor=CENTER)

canvas.pack()

______________________

Thanks for any help provided. 

Henry Steigerwaldt

Hermitage, TN




--Boundary_(ID_S58WlvxoZciU2hQLq9cQqg)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>To All:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Can anyone tell me what is wrong with this code? I 
am </FONT></DIV>
<DIV><FONT face=Arial size=2>simply trying </FONT><FONT face=Arial size=2>to 
display a .GIF&nbsp;file on a canvas. The canvas</FONT></DIV>
<DIV><FONT face=Arial size=2>is placed on a toplevel window 
(root).</FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>No errors occur, but yet the .GIF file never 
appears on&nbsp;the </FONT></DIV>
<DIV><FONT face=Arial size=2>canvas. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have played around with this thing for probably 
30 </FONT></DIV>
<DIV><FONT face=Arial size=2>minutes or longer without any success. 
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Below is the code&nbsp;snipet:</FONT></DIV>
<DIV><FONT face=Arial size=2>_________________________________</FONT></DIV>
<DIV><FONT size=2>
<P>root = Tk()</P>
<P>root.geometry('1024x768+125+100')</P>
<P>canvas = Canvas(root, width=950, height=700)</P>
<P>img = PhotoImage(file = '\\python_pgms\\plot_guidance\\guid_map.gif') </P>
<P>canvas.create_image(600,400, image=img, anchor=CENTER)</P><FONT size=2>
<P>canvas.pack()</P>
<P><FONT face=Arial>______________________</FONT></P>
<P><FONT face=Arial>Thanks for any help provided. </FONT></P>
<P><FONT face=Arial>Henry Steigerwaldt</FONT></P>
<P><FONT face=Arial>Hermitage, TN</FONT></P>
<P><FONT face=Arial></FONT>&nbsp;</P></FONT></FONT></DIV></BODY></HTML>

--Boundary_(ID_S58WlvxoZciU2hQLq9cQqg)--