Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:36:02+00:00 2026-06-15T13:36:02+00:00

Is there a way I can set the default color of canvas objects (lines,

  • 0

Is there a way I can set the default color of canvas objects (lines, rectangles, etc.) without setting each one individually? I know the default color is black, and I basically just want to change that so that everything I subsequently create is, say, green. Is there a way to do this with Tkinter in Python?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:36:05+00:00Added an answer on June 15, 2026 at 1:36 pm

    No, there is no way to set the default color. However, if you store the color in a variable, you can use that whenever you create new items.

    self.my_color = "red"
    ...
    self.canvas.create_rectangle(..., fill=my_color)
    

    You can also change all objects at once by giving the id “all” to the itemconfigure method. For example:

    self.my_color = "green"
    self.canvas.itemconfigure("all", fill=self.my_color)
    

    For more on item identifiers (including the special “all” identifier) see Item Specifiers: Handles and Tags on effbot.org as well as the Tags section in the canvas tutorial on tkdocs.com

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way I can set the default ModelBinder to one of my
Is there a way I can set up a client-side script/hook/setting/whatever to have a
Is there a way in mysql I can set to default? $q = $dbc
author = models.ForeignKey(User) Is there any way I can set the default value of
Is there any way I can set a formatter on models that will convert
Using htmlentities() is there a way I can set to allow only <b> and
In a custom view, is there a way I can set the center of
Is there a way by which we can set the focus to a particular
IS there any way to set the maximumtime a cookie can be inactive in
I can easily check IP addresses programmatically, but is there any way to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.