[Tutor] Tkinter canvas movement question...

Jason O'Dell jodell2@tsn.cc
Thu, 23 Aug 2001 16:29:40 +1000


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C12BF0.CEE8E740
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Fellow list users, I JeSo (long time reader, first time poster) come =
bearing problems...
Ok, using Tkinter, I have the following code,

class dude:
    def __init__(self):
        self.physical =3D screen.create_oval(30,270,60,300, =
fill=3D'white', outline=3D'white')
    def left(self):
        screen.move(self.physical, 5, 5)

(screen is earlier defined as a Tkinter Canvas widget)

and elsewhere i have,

circle =3D dude()
root.bind_all('<Left>', circle.left())

...Any ideas why that wont work? It simply draws up everything, with the =
object already moved once, without any pressing of left, and future =
pressings of left have no effect. Any help on this lil problem would be =
appreciated...  Also, any suggestions on how I could best put that =
binding inside the class itself?
   Thankyou all...
       JeSo

 =
-------------------------------------------------------------------------=
-----------------------
"You love to hate me, but you wont kill me" - Slayer - Love to Hate.

------=_NextPart_000_0005_01C12BF0.CEE8E740
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Fellow list users, I JeSo (long time =
reader, first=20
time poster) come bearing problems...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Ok, using Tkinter, I have the following =

code,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class dude:<BR>&nbsp;&nbsp;&nbsp; def=20
__init__(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
self.physical =3D=20
screen.create_oval(30,270,60,300, fill=3D'white',=20
outline=3D'white')<BR>&nbsp;&nbsp;&nbsp; def=20
left(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
screen.move(self.physical, 5, 5)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>(screen is earlier defined as a Tkinter =
Canvas=20
widget)</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and elsewhere i have,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>circle =3D dude()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>root.bind_all('&lt;Left&gt;',=20
circle.left())</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>...Any ideas why that wont work? It =
simply draws up=20
everything, with the object already moved once, without any pressing of =
left,=20
and future pressings of left have no effect. Any help on this lil =
problem would=20
be appreciated...&nbsp; Also, any suggestions on how I could best put =
that=20
binding inside the class itself?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; Thankyou =
all...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
JeSo</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;----------------------------------------------------------=
--------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>"You love to hate me, but you wont kill =
me" -=20
Slayer - Love to Hate.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0005_01C12BF0.CEE8E740--