title: How to change the pixel color of a PhotoImage python
body: <p>So i have a program for gui i want to change the pixel color based on the values of the rgb sliders i made, I can't figure out how to change the pixel colors.
  I searched for like an hour and I can't find anything.</p>
  
  <pre><code>from tkinter import *
  
  
  
  class Colors(Frame):
     def __init__(self):
      Frame.__init__(self)
      self._image = PhotoImage(file="r.gif")
      self._imageLabel = Label(self, image=self._image)
      self._imageLabel.grid()
  
      self.master.title("Color Changer")
      self.grid()
  
      self.red = Scale(self, from_=0, to=255, label="Red", fg="red", )
      self.red.grid(row=0, column=1)
  
      self.green = Scale(self, from_=0, to=255, label="Green", fg='green')
      self.green.grid(row=0, column=2)
  
      self.blue = Scale(self, from_=0, to=255, label="Blue", fg="blue")
      self.blue.grid(row=0, column=3)
  
      self.button = Button(self, text="Change Colors", command=self.changeColor(self._image))
      self.button.grid(row=1, column=2)
  
  def changeColor(self, image):
      red = self.red.get()
      blue = self.blue.get()
      green = self.green.get()
      for y in range(image.height()):
          for x in range(image.width()):
              image.put()
  
  
  def main():
  Colors().mainloop()
  
  
  main()
  </code></pre>
  
  <p>that's what i have so far</p>
  
  <p>EDIT: I did it with a method defined Fill here it is`
  def fill(self):</p>
  
  <pre><code>def fill(self):
              """Fill image with a color=(r,b,g)."""
              r, g, b = (self.red.get(), self.green.get(), self.blue.get())
              width = self._image.width()
              height = self._image.height()
              hexcode = "#%02x%02x%02x" % (r, g, b)
              horizontal_line = "{" + " ".join([hexcode] * width) + "}"
              self._image.put(" ".join([horizontal_line] * height))
  </code></pre>
  
  <p>and i used that instead of my changeColor method and it works beautifully!</p>