0

I want to create a painter in tkinter And I want there to be an option to upload a picture to draw so that it will be uploaded in line-by-line form That is to say we have a rectangle that is made up of 2 lines that each line has 4 pixels So on the painting canvas it will be possible to see how the image is constructed on the canvas so that it fills line by line when one line fills in 4 pixels The second row begins to fill up Until the image of the rectangle is created Intended to create a list of all the colors of the pixels of the image And build it on the canvas So that while running it will be possible to see how the image is constructed Is there such an option? Do you have any idea what code could do this?

  • Do you mean this : https://stackoverflow.com/questions/46923244/how-to-create-image-from-a-list-of-pixel-values-in-python3 maybe? Your question is pretty vague. – Ashwin Phadke Feb 25 '22 at 19:21
  • Pixel-by-pixel as per your title? Or line-by-line as per the text of your question. They are different. Do you mean the top row of your image then the second row? Or the first pixel of a line from point A to B then the second pixel of that line - which may be diagonal? – Mark Setchell Feb 25 '22 at 19:51
  • Yes, there is a way. One way is to manipulate a tkinter canvas. Python has a graphical library named tkinter. tkinter has an object named canvas. The image area on the canvas would have a width and height. For example, 1000 x 1000 would have 1 million pixels. Those would require for example 1 million tuples where each tuple has (red,green,blue) value for each pixel. – Carl_M Feb 25 '22 at 21:13
  • Also, look at How to draw square pixel by pixel (Python, PIL) https://stackoverflow.com/questions/54346063/how-to-draw-square-pixel-by-pixel-python-pil. – Carl_M Feb 25 '22 at 21:20
  • I mean line by line. This means that during the run the image will not appear directly on the canvas of the painting. Rather we will see it being built line by line. Say the top left edge of the image will be at point x = 0, y = 0, the width of the image is 100 pixels and the length is 200 pixels so while running we can see on the canvas how the image is built line by line i.e. the first line of pixels will be built and then the second line and so on. Image 100 pixels wide and 200 pixels long. – Shira Sinai Feb 26 '22 at 20:41

0 Answers0