Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: x, y coordinates in Tkinter canvas

Reply
Thread Tools

Re: x, y coordinates in Tkinter canvas

 
 
jepler@unpythonic.net
Guest
Posts: n/a
 
      11-11-2005
Let's find out! This program creates a series of rectangles, with the color
going from black to nearly white. White corresponds to higher x and y
coordinate values. So the answer to your question can be seen in the output
of the program.

import Tkinter

c = Tkinter.Canvas(width=220, height=220)
c.pack()

for i in range(0, 200, 20):
lum = i * 255 / 200
color = "#%02x%02x%02x" % (lum, lum, lum)
c.create_rectangle( i, i, i+40, i+40, fill=color)

c.mainloop()

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDdS9LJd01MZaTXX0RAvNIAJ4552/g04KpSXqt2r/oqh1Z7A27jACeJSGz
EBRFIU7j0uFQbw5pgkZFQt4=
=wqwa
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
x, y coordinates in Tkinter canvas Shi Mu Python 0 11-11-2005 11:47 PM
Canvas with scrollbars - how to get correct canvas coordinate when the scroll bars have moved? PhilC Python 2 10-25-2004 11:57 AM
Canvas scrolling - scrollBar become "disabled" on change in canvas Askari Python 2 08-30-2004 02:56 PM
Converting canvas coordinates to window coordinates in tkinter......... Suresh Kumar Python 0 07-04-2003 10:14 AM
Converting canvas coordinates to window coordinates....... Suresh Kumar Python 0 07-03-2003 04:53 AM



Advertisments