Newbie alert !

Jean Montambeault iaminnocent at videotron.ca
Fri Dec 3 06:38:54 EST 2004


I am not only learning Python but programming itself ; reading your 
posts makes me believe that nobody is that much of a beginner here. Is 
there a newgroup or list for my type somewhere I can't find it ?

To illustrate my case this script :

<CODE>

# function to draw rings for an Olympic flag
def rings(size,offsetX,offsetY,coul):
     x1,y1,x2,y2 = 170, 103, 170, 103,
     can1.create_oval(x1-size-offsetX,y1+size+offsetY,\
                      x2+size-offsetX,y2-size+offsetY,\
                      width=8, outline=coul)

# **main****main****main****main****main****main**

fen1=Tk()
can1=Canvas(fen1, bg='white', height=206, width=340)
can1.pack(side=LEFT)

bou_europe=Button(fen1, text='Europe',\
                   command=rings(41, 100, -22, 'blue'))
bou_europe.pack( )

bou_asia=Button(fen1, text='Asia',\
                   command=rings(size=41, offsetX=50,offsetY=22, 
coul='yellow'))
bou_asia.pack( )

bou_africa=Button(fen1, text='Africa',\
                   command=rings(size=41, offsetX=0,offsetY=-22, 
coul='black'))
bou_africa.pack( )

bou_australia=Button(fen1, text='Australia',\
                   command=rings(size=41, offsetX=-50,offsetY=22, 
coul='dark green'))
bou_australia.pack( )

bou_america=Button(fen1, text='America',\
                   command=rings(size=41, offsetX=-100,offsetY=-22, 
coul='Red'))
bou_america.pack( )

bou_quit=Button(fen1, text='Quit', command=fen1.quit)
bou_quit.pack(side=BOTTOM)

fen1.mainloop()
fen1.destroy()

</CODE>

I just cannot figure out why the rings are draw right from the start and 
  don't wait for their buttons to be pressed before being drawn :  I've 
written similar functions before to draw lines, rectangles and whatever 
else with success.

Using Python 2.3, IDLE and Win2k.

Thanks for your time

Jean Montambeault



More information about the Python-list mailing list