Repository navigation
EV3-G API Display - #410
Conversation
|
|
||
| screen.image.paste(picture, (0, 0)) | ||
| """ | ||
| return self._img |
There was a problem hiding this comment.
I think we should do what we can to keep this accessor in some form, as it's what all existing display code is based on.
There was a problem hiding this comment.
I'm trying to remember why I removed this and can't come up with a good reason....will put this back and rename the other def image to def image_filename
|
I just noticed the EV3-G display block for text allows you to specify font size in terms of @ddemidov any recommendations on what fonts we should use for those three choices? |
| else: | ||
| return self._img.paste(filename_im, (x1, y1)) | ||
|
|
||
| def shapes_line(self, clear_screen=True, x1=0, y1=0, x2=0, y2=0, line_color='black', width=1): |
There was a problem hiding this comment.
Why not draw_line, draw_circle, etc.?
|
|
||
| return self.draw.line((x1, y1, x2, y2), fill=line_color, width=width) | ||
|
|
||
| def shapes_circle(self, clear_screen=True, x=50, y=50, radius=40, fill_color='black', outline_color='black'): |
There was a problem hiding this comment.
Document color options and how to make it transparent
There was a problem hiding this comment.
How do you make it transparent? We are way beyond my experience level with PIL :)
Regarding supported color names, PIL says they support Common HTML colour names, I could never find a definitive list of the color names they support so didn't attempt to include that in the doc string.
There was a problem hiding this comment.
oh, I don't know... I've never used it 😆 My guess is to pass None.
| x2 = x + radius | ||
| y2 = y + radius | ||
|
|
||
| return self.draw.ellipse((x1, y1, x2, y2), fill=fill_color, outline=outline_color) |
There was a problem hiding this comment.
What would happen if you passed, say, red to this function in the EV3 (the EV3 has a monochrome display)? Does it convert the color brightness to a single greyscale channel, or do something else?
There was a problem hiding this comment.
red it converted to black on my EV3. I don't know if there is a cutoff where something close to white translates to white instead of black or not.
| else: | ||
| return self.draw.text((x, y), text, fill=text_color) | ||
|
|
||
| def text_grid(self, text, clear_screen=True, x=0, y=0, text_color='black', font=None): |
There was a problem hiding this comment.
Document what these two text methods do... I'm a bit confused myself
There was a problem hiding this comment.
Isn't there a page somewhere that shows what all of the different fonts look like on the EV3 screen? I'm looking but can't find it...was going to include that in the doc string
There was a problem hiding this comment.
http://python-ev3dev.readthedocs.io/en/latest/other.html#ev3dev.fonts.load (e6a1dde)
I couldn't find info on how this was generated... somewhere I think @ddemidov had a Jupyter notebook with some code for it.
There was a problem hiding this comment.
There was a problem hiding this comment.
#225 links to the notebook with the code used to generate the image.
| GRID_ROWS = 12 | ||
| GRID_ROW_PIXELS = 10 | ||
|
|
||
| def __init__(self, desc='Display'): |
There was a problem hiding this comment.
I'm curious... what is the description for?
There was a problem hiding this comment.
It is just so if you print the object as a string the __str__ has something to work with
|
|
||
| return self.draw.line((x1, y1, x2, y2), fill=line_color, width=width) | ||
|
|
||
| def circle(self, clear_screen=True, x=50, y=50, radius=40, fill_color='black', outline_color='black'): |
There was a problem hiding this comment.
These defaults seem a bit random 😆
I swear, this is my last comment 😉 I need to be better about all-in-one reviews.
There was a problem hiding this comment.
yeah those are just so the user sees a full circle on the screen if they are kicking the tires and call circle() without passing any args

For issue #356