Closed 54c5ff0a-a57c-4f07-89d4-4f703bfd9ea2 closed 10 years ago
Python's Turtle module doesn't support transparency. ----------------------------------------------------
I emailed the developer that was listed in the Turtle module code, thinking that was the right way to get help updating it.
I then messaged Python's Facebook page looking for anybody to help me with this issue.
I then gave a shout out to Jessica McKellar of the Boston Python User Group, in hopes that she'd know what to do, as she's more of a Python guru than I.
She recommended I submit a bug report. Fancy that :)
I'm writing a book to teach the community art, and I want to use Python as the core for the computer graphics lessons.
While I can create basic graphics, I feel totally constrained by the lack of of RGBA support.
What I'd like is for the Turtle module to default to RGB if three values are given in the tuple for color, but if an optional 4th value exists, then it'll use that value for alpha transparency.
I would think it would be OK if it follows a simlar convention: 0 - 255 (vs) 0 - 1.0 transparency range depending on how the previous three values for color were inputted.
I looked into the Turtle code. While it looks like it would be possible to impliment there, I believe the bottleneck is the tkinter that it relies on.
I don't believe that tkinter handles transparency in Linux.
I wouldn't think this would be an unsurmountable hurdle, as there's a similar Python + Tutle combo out there called Pynguin that actually handles transparency.
I couldn't get as much out of that though, because I'd have to battle with the interface.
I also considered other modules, such as matplotlib or Pygame, but I think that's adding a layer of complexity that I'd rather the end-user not have to deal with.
If anyone can take on this challenge and help out, together, we can take Python graphics to the next level :D
From a little researching it isn't clear whether it is just tkinter that doesn't support alpha, or if TK itself has issues...but I'm hoping it is just the former (I found discussions of alpha for images, and it sounds like the Tk canvas supports displaying such images, but I couldn't find anything definitive about non-image support for alpha values). If Tk doesn't have full support, you'd have to take a step farther back and get the needed RGBA support into TK itself. Using a graphics package other than TK is a non-starter for the standard library.
So, assuming TK supports it, this is two feature requests: tkinter alpha channel support, and Turtle RGBA support.
As a feature request it can only go into 3.5. The tkinter piece should be split out into another issue, with this one depending on it.
There are some people interested in improving tkinter (mostly in the IDLE context currently), but unless you can submit patches yourself probably the best hope for this is for it to get picked up in the GSOC or OPW context as a student project.
Serhiy, do you know about whether Tk (and tkinte) have any image alpha (transparency) support?
Tk supports alpha only for photo images and as an attribute of top-level window. It doesn't support alpha component in colors.
The desired color is specified with an object whose string value
must have one of the following forms:
colorname Any of the valid textual names for a color defined
in the server's color database file, such as red or
PeachPuff.
#RGB
#RRGGBB
#RRRGGGBBB
#RRRRGGGGBBBB A numeric specification of the red, green, and blue
intensities to use to display the color. Each R,
G, or B represents a single hexadecimal digit. The
four forms permit colors to be specified with
4-bit, 8-bit, 12-bit or 16-bit values. When fewer
than 16 bits are provided for each color, they rep-
resent the most significant bits of the color,
while the lower unfilled bits will be repeatedly
replicated from the available higher bits. For
example, #3a7 is the same as #3333aaaa7777.
Closing due to 3rd party limitation, much as I wish it were not so.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['expert-tkinter', 'type-feature', 'library']
title = 'Turtle module transparency.'
updated_at =
user = 'https://bugs.python.org/EliInnis'
```
bugs.python.org fields:
```python
activity =
actor = 'terry.reedy'
assignee = 'none'
closed = True
closed_date =
closer = 'terry.reedy'
components = ['Library (Lib)', 'Tkinter']
creation =
creator = 'Eli Innis'
dependencies = []
files = ['34411']
hgrepos = []
issue_num = 20920
keywords = []
message_count = 5.0
messages = ['213515', '213546', '213603', '213643', '213685']
nosy_count = 4.0
nosy_names = ['terry.reedy', 'r.david.murray', 'serhiy.storchaka', 'Eli Innis']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue20920'
versions = ['Python 3.5']
```