[Tutor] Introduction/ box

Gregor Lingl glingl at aon.at
Mon Nov 29 20:11:31 CET 2004


Hello nige ill try to give you an example which makes you a rectangle 
but only using tkinter which comes with python and is its standard 
graphics toolkit as i dont know pygame well enough here is it maybe it 
can be done similarly in pygame notice please that python is an 
artificial language so it has to be written more structured than natural 
languages like your english otherwise the programs wont run so please 
type the pragram exactly as it is written here provided your email 
client or mine dont destroy the correct structure which is not very 
probable coz the structure is very simple look:

from Tkinter import *

root = Tk()
cv = Canvas(root, width=400, height=300, bg="blue")
cv.pack()
cv.create_rectangle(50,30,320,290,outline="yellow",fill="red",width=10)

mainloop()

--------- natural language following you can play around with the 
numbers in this program so you can find out what their meaning is eg 
replace 320 by 177 and so on and also with the names of the colors eg 
exchange them or replace "red" by "violet" and so on if you then want to 
go over to pygame contact the pygame mailing list you can find a link to 
it on the pygame website hope this helps gregor


cm012b5105 schrieb:

>Hello every body im new to python iv allways wanted to have go
>iv noticed there is loads of tutorials on the net for it any way i have a 
>question which i hope some one will help me find the answer i want to know 
>how to draw a box iv just installed pygame as i would like to have a go at 
>making my own game i thought if i could get the source for something simple 
>like drawing a box that would give me something to start with i hope this 
>makes sense if not please tell me ill try to explain better thankyou
>    nige
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>  
>


More information about the Tutor mailing list