473,327 Members | 2,012 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,327 software developers and data experts.

Changing fill in tkinter

Hi,
I would like to know how to change the fill of things we put in a
tkinter's canvas. for example, if i create a rectangle and i would want
to change the fill of the rectangle once it is clicked... can we do
that?

Jan 13 '06 #1
2 11000
On 13 Jan 2006 01:43:42 -0800, venk <ve****************@gmail.com> wrote:
Hi,
I would like to know how to change the fill of things we put in a
tkinter's canvas. for example, if i create a rectangle and i would want
to change the fill of the rectangle once it is clicked... can we do
that?


Not sure if I correctly understand your question, but you seem to look for
itemconfigure:
from Tkinter import *
root = Tk()
c = Canvas(root)
c.pack()
r = c.create_rectangle(20, 20, 60, 60)
c.itemconfigure(r, fill='blue')


Is that what you were after?

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
Jan 13 '06 #2
yes, it was a stupid mistake from my part in not pondering over the api
fully. forgive me. anyways, ii was just looking for item configure. (I
was spending all my time searching google rather than reading the api
sincerely. duh...)

Jan 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeffrey Barish | last post by:
Is there a way to fill the values in an OptionMenu dynamically? I need something like the add_command method from Menu. Is there a better way to implement a pull-down list? -- Jeffrey Barish
9
by: Harlin Seritt | last post by:
I am trying the following: Listbox(parent).pack(fill=BOTH, expand=YES) I notice that the listbox will fill on the X axis but will not on the Y axis unlike other widgets. Is there any way to...
0
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
7
by: Phin | last post by:
I need your HELP! I've seen all the posts on using Crystal Reports within vs.net (vb.net) and changing a SQL query at runtime. When I tried to pass in a dataset into the crystal report at...
7
by: Dan Sikorsky | last post by:
How do you iterate thru a dataset to change money fields to a different value? Here's what I have. My dataset is filled directly from a stored procedure. ' Create Instance of Connection and...
5
by: Mudcat | last post by:
I was trying to design a widget that I could drag and drop anywhere in a frame and then resize by pulling at the edges with the mouse. I have fiddled with several different approaches and came...
6
Sushi
by: Sushi | last post by:
Hello! I'm new to the Python language(about 2 months). Having done C programming for 2 years I find out I need Python for a final project, and have been trying to do get my head around object...
2
by: KDawg44 | last post by:
Hi, I am writing a GUI front end in Python using Tkinter. I have developed the GUI in a grid and specified the size of the window. The widgets are centered into the middle of the window. I...
0
by: execrable | last post by:
I am writing a simple (maybe a bit conveluded, but I just started learning Tkinter) program that uses a 'notebook' code snippet from a python cookbook. It creates a customizable frame and radio...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.