frozenevil
Programmer
Hi!! Actually,i am doing a simulation and i want a dot (small oval) to pop up when i click(by mouse) on the canvas.
can anyone please help me or if possible give me the piece of codes to perform this.
thanks in advance...
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")
button=Tkinter.Button(frame,fg="blue", text="GENERATE", activebackground='red',font=('verdana', 10, 'bold'),command=generate).pack(padx =50,side = LEFT)
root = Tkinter.Tk()
root.mainloop()
can anyone please help me or if possible give me the piece of codes to perform this.
thanks in advance...
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")
button=Tkinter.Button(frame,fg="blue", text="GENERATE", activebackground='red',font=('verdana', 10, 'bold'),command=generate).pack(padx =50,side = LEFT)
root = Tkinter.Tk()
root.mainloop()