[Tutor] help for tkinter
Denis
spirou@aragne.com
Mon, 28 Aug 2000 09:56:14 +0200
Le Mon, Aug 28, 2000 at 04:08:13PM +1100, Phoon, David pianota:
>
> hi I did the following and got what was expected, a dialog box to show
> tkinter is present and ok. however how do you use or make a canvas to draw
> the arc as below?within the winPython ide
> >>> import Tkinter
If you import Tkinter you will have to qualify all the widgets.
Usually, everything from Tkinter is imported :
from Tkinter import *
> >>> Tkinter._test()
> >>> xy = 20,20,30,180
> >>> canvas.create_arc(xy,start=0,extent=270,fill ="red")
> Traceback (innermost last):
> File "<interactive input>", line 0, in ?
There, you call a method on an object that is not intanciated yet.
Try something like :
root = Tk()
cv = Canvas(root)
cv.pack(expand=YES, fill=BOTH)
xy = 20,20,30,180 # not very large, but it's as you like it
cv.create_arc(xy, start=0, extent=270, fill="red")
etc.
You should have a look at those pages :
http://www.pythonware.com/library/tkinter/introduction/index.htm
http://www.manning.com/Grayson/index.html
http://www.oreillynet.com/pub/a/python/excerpts/chpt20/index.html
and some others.
Have fun
--
Denis FRERE
P3B : Club Free-Pytho-Linuxien Caroloregien http://www.p3b.org
Aragne : Internet - Reseaux - Formations http://www.aragne.com