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?
Share
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.
You can also change all objects at once by giving the id “all” to the itemconfigure method. For example:
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