Draw a pixel: Difference between revisions
Content added Content deleted
(Created page with "{{task|GUI}}Category:Basic language learning{{requires|Graphics}} Category:Simple ;Task: Create a window and draw a pixel in it ::# 1-the window is 320 x 240 :...") |
No edit summary |
||
Line 7: | Line 7: | ||
::# 2- the color of the pixel must be red (255,0,0) |
::# 2- the color of the pixel must be red (255,0,0) |
||
::# 3-that the position of the pixel is x = 100, y = 100 |
::# 3-that the position of the pixel is x = 100, y = 100 |
||
=={{header|Python}}== |
|||
{{works with|Python |2.7.14}} |
|||
{{libheader|PIL}} |
|||
<lang Python>from PIL import Image |
|||
img = Image.new('RGB', (320, 240)) |
|||
pixels = img.load() |
|||
pixels[100,100] = (255,0,0) |
|||
img.show() |
|||
</lang> |
Revision as of 14:57, 7 May 2018
Draw a pixel
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
Create a window and draw a pixel in it
- 1-the window is 320 x 240
- 2- the color of the pixel must be red (255,0,0)
- 3-that the position of the pixel is x = 100, y = 100
Python
<lang Python>from PIL import Image
img = Image.new('RGB', (320, 240)) pixels = img.load() pixels[100,100] = (255,0,0) img.show() </lang>