473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

tkinter<< placing dot>>

3
hi everybody...i'm trying to place an oval with a mouse click on my tkinter interface.
can anyone please give me the code of how should i do it.
i just want the part that i should add so that by clicking on interface an initial oval appear.
thank you in advance..
here is my code.


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)
#button2=Tkinter.Button(frame,fg ="blue",activebackground='red',font=('verdana', 10, 'bold'),command=generate).pack(padx =50,side = LEFT)



root = Tkinter.Tk()

# kick off the window's event loop
root.mainloop()
Jan 30 '08 #1
0 1188

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Christopher Subich | last post by:
I'm building an application involving both twisted and Tkinter. Since twisted co-opts <widget>.mainloop() in its reactor.run(), and since it behaves very badly if the application quits without...
1
by: Nicholas Shewmaker | last post by:
(I apologize if this posts twice. My AVG is being fussy.) From what I've read, MouseWheel is a very tricky event. I have replaced my Python tcl84.dll and tk84.dll files with those in the...
3
by: Jay | last post by:
I'm having trouble with using the <Keyevent with the Text object. When I use them together (which is a logical combination), I use this code: textbox = Text(root, wrap="word", height=15,...
20
by: elderic | last post by:
Hi there, are there other ways than the ones below to check for <type 'function'> in a python script? (partly inspired by wrapping Tkinter :P) def f(): print "This is f(). Godspeed!" 1.:...
4
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for...
4
by: bytecolor | last post by:
I'm trying to extract the text of the current line on the <<Modified>> event. It doesnt work if I delete a character. If I type 'abc' I get 'abc' in text_changed(). If I hit backspace I still get...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.