473,655 Members | 3,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11033
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_rectan gle(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.zmz 5(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
11300
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
3985
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 force this? thanks, Harlin
0
2026
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 scroll-bars work as advertised. That's great. However, if you click the Left Mouse button, it calls code which expands the width of the canvas by 100 pixels. The area being viewed expands correspondingly..... BUT I DON'T WANT IT TO!!
7
4007
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 runtime, the report still showed the results from the default query (from within the Crystal Report). Then I tried the XSD solution where you define a dataset (that mataches the database and the Crystal Report) and have the Crystal Report use this....
7
5258
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 Command Object Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim myCommand As New SqlDataAdapter("OrdersList", myConnection)
5
1969
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 across this behavior when using the combination of place() and configure(cursor = ...) This problem doesn't occur if you remove either one of these elements. It's a very basic design of a button wrapped in a sizer frame and is supposed to work like...
6
7607
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 oriented programming. At the moment I'm simply trying to get the colour of a circle to change when you press a button. I've got this so far: from Tkinter import * class Op: def __init__(self, master):
2
1672
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 would like them to fill the window. I tried using the sticky=E+W+N+S option on the widgets themselves and the window itself. How can I get this?
0
1109
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 button for each 'tab' and uses .forget to hide the frames that aren't 'current'. I modified it to use a Scale slider bar instead of radio buttons. What my program does is create a parent notebook object, and in each notebook frame, child...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.