0

hi..... i want to make a simulation where it start with 1 dot and its continues to propagate like the figure below.


. inital dot
...
......
........

can anyone please tel me how to do it or give me the pieces of codes needed to do this plz
i'm using tkinter (canvas) as interface.

Here is my codes

from Tkinter import *
import Tkinter
from Tkconstants import *
import random


frame=Tkinter.Frame()
frame.pack()

canvas =Tkinter.Canvas(frame,bg = 'white',width=200, height=400)
canvas.pack()

def generate():
for i in range(50):

x1=random.randrange(500)
y1=random.randrange(500)
x2=x1+5
y2= y1+5

canvas.create_oval(x1,y1,x2,y2,fill ="red")

canvas.create_oval(110,300,113,303,fill ="black") # inital point
button=Tkinter.Button(frame,fg="blue", text="GENERATE", activebackground='red',font=('verdana', 10, 'bold'),command=generate).pack(padx =50,side = LEFT)
#button2=Tkinter.Button(frame,fg ="blue",activebackground='red', text="RESET",font=('verdana', 10, 'bold'),command = circle).pack()


root = Tkinter.Tk()

# kick off the window's event loop
root.mainloop()


thanks in advance

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by BearofNH
0

i'm asking for help because just a novice to python

0

There's nothing wrong with asking for help and nothing wrong with being a novice. But when you ask for help, around here at least, it is expected you will wrap your code in code-tags as already explained. If nothing else, it increases the odds someone will look at it.

When I read your posting, beneath the initial dot, I see a right triangle. Why would you want to use create_oval() to generate a triangle? I suspect there's a good explanation -- but your posting doesn't seem to offer one.

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.