tracer une cercle dans python tkinter?
Peter Otten
__peter__ at web.de
Fri Mar 1 14:06:29 EST 2013
olsr.kamal at gmail.com wrote:
> comment tracer une cercle contient un numéro au un symbole dans le center
> dans python tkinter?
[I hope you can cope with English]
Use a Canvas widget:
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root, width=240, height=240)
canvas.pack()
canvas.create_oval((20, 20), (220, 220), width=10, fill="white")
tag = canvas.create_text(120, 120, text="42", justify=tk.CENTER,
font=("Helvetica", 110), fill="#800")
if 1: # fancy stuff; you can safely remove the complete if-statement
def n(x):
while True:
for i in reversed(range(x+1)):
yield i
values = n(42)
def down():
text = str(next(values))
canvas.itemconfig(tag, text=text)
root.after(300, down)
down()
root.mainloop()
See
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/canvas.html
for more.
More information about the Python-list
mailing list