title: TypeError takes 2 positional arguments but 3 were given
body: <p>I am working on a program that converts images to .mcfunction files for minecraft bedrock and java edition. In my program, i'm using for loops to plug in for x and y coordinates in <code>image.getpixel</code>. However, this entire night I've been stuck with the error</p>
  <blockquote>
  <p>TypeError: getpixel() takes 2 positional arguments but 3 were given</p>
  </blockquote>
  <p>and am not sure what is causing this. I used to not have this problem but I recently added a function that rotates the image preview and all of the sudden this started happening. Here is my program:</p>
  <pre><code>  from tkinter import *
    from tkinter.ttk import *
    from tkinter import filedialog
    from PIL import ImageTk,Image
    import os
    from casegen import casegenerator
    from tkinter import ttk
    from tkinter import messagebox
  
    #creates window
    root = Tk()
    root.title(&quot;Pixelcraft V1.0&quot;)
    root.iconbitmap(&quot;pixlcraftlogo_tKt_icon.ico&quot;)
    root.geometry(&quot;500x350&quot;)
    print(&quot;Sucessfully loaded window!&quot;)
  
  
    #declares a button style
    style = Style()
    style.configure('W.TButton', font =
                   ('calibri', 10, 'bold', 'underline'), 
                    foreground = 'black')
  
    #declares a canvas style
    canvas_width = 390
    canvas_height = 210
  
    my_canvas = Canvas(root, width=canvas_width, height=canvas_height, highlightthickness=1,                         
    highlightbackground=&quot;gray&quot;)
    my_canvas.configure(bg='white')
  
    my_canvas.place(x=50, y=70)
  
    startupimg = ImageTk.PhotoImage(Image.open(&quot;PixlCraftLogo.png&quot;))
  
    #loads image and puts it on canvas
    canvasstartuplogo = my_canvas.create_image(195, 105,image=startupimg)
  
    #widgets and functions:
  
    #makes a prompt to name the function
    def filenameinput():
        convertbtn.destroy()
        ent.place(x=160, y=30)
        ent.insert(0, &quot;Enter a filename&quot;)
  
        confbutton.place(x=300, y=28)
  
    #color comparer
    def warningmaker():
        messagebox.showinfo(&quot;Warning&quot;, &quot;Depending on how large your image is, PixelCraft may become                               
    unresponsive. Please be patient and dont close the tab to prevent file corruption.&quot;)
  
  
        imgtofunc()
  
    def imgtofunc():
  
        confbutton.destroy()
        ent.destroy()
        fullcommand = str(&quot;&quot;)
        steps = width/100
  
        #scans the pixels in x axis
        for i in range(width):
  
      
            #scans the pixels in y axis
            for j in range(height):
  
                #returns rgb values as tuple
          
                mred, mgreen, mblue = imgfcalc.getpixel(i, j)
      
                blockofpix = casegenerator(mred, mgreen, mblue)
  
                singlecommand = &quot;setblock&quot; + &quot; &quot; + &quot;~&quot; + &quot; &quot; + &quot;~&quot; + str(j*-1) + &quot; &quot; + &quot;~&quot; + str(i) + &quot; 
    &quot; + str(blockofpix) + &quot;\n&quot;
          
                singlecommand = str(singlecommand)
          
                fullcommand = fullcommand + singlecommand
          
                #print(casegenerator(mred, mgreen, mblue))
                   
                #print(test1)
  
        print(fullcommand)
  
    #function executes after import button is pressed 
    def importimages():
        #global variables must be defined in order for images to work
        global userchosenimg
        global userfile
        global newtext
        global width
        global height
        global imgfcalc
  
        #file dialog prompt
        userfile = filedialog.askopenfilename(title=&quot;Select an image&quot;, filetypes = ((&quot;All Files&quot;, 
    &quot;*.*&quot;), (&quot;jpeg&quot;, &quot;.jpeg&quot;), (&quot;jpg&quot;, &quot;.jpg&quot;), (&quot;png&quot;, &quot;.png&quot;)))
  
  
        #creates a variable of just the file name rather than the whole location
        for i in range(len(userfile)):
            userfilestrindex = userfile[i*-1]
            if userfilestrindex == &quot;/&quot;:
                charsuntilslash = len(userfile) - i
                newtext = userfile[charsuntilslash+1:len(userfile)]
                break          
  
        #displays name of selected image
        userimagefilename = Label(root, text=newtext, font=(&quot;Arial&quot;, 8))
        userimagefilename.place(x=40, y=30)
  
  
        #removes the import button
        importimages1.place_forget()
  
        #removes the default logo
        my_canvas.delete(canvasstartuplogo)
  
        #removes the name of the default image
        defaultimgfile.destroy()
  
        #copys the image and converts it so that it has a numeric value of rgb
        imgfcalc = Image.open(userfile)
        width, height = imgfcalc.size
        image_rgb = imgfcalc.convert(&quot;RGB&quot;)
  
        loadontocanvas(0)
        #puts image on canvas
    imgangle1 = 0
    def loadontocanvas(rotationalangle):
        global resized
        global finalpic
        global userchosenimg1
        global userchosenimg
  
        print(&quot;loading...&quot;)
        try:
            my_canvas.delete(userchosenimg1)
        except:
            print(&quot;&quot;)
        numforrez = (width*175)/height
  
        userchosenimg = Image.open(userfile)
        resized = userchosenimg.resize((int(numforrez), 175), Image.ANTIALIAS)
        resized = resized.rotate(angle=imgangle1)
        finalpic = ImageTk.PhotoImage(resized)
  
  
        userchosenimg1 = my_canvas.create_image(195, 105,image=finalpic)
  
  
        print(&quot;successfully imported image&quot;)
  
        rotateimgbtn.place(x=50, y=300)
  
        convertbtn.place(x=207, y=28)
    #end of function
  
    rotq = &quot;&quot;
    rotp = &quot;&quot;
    def rotatetheimg():
        global imgangle1
        global rotq
        global rotp
  
  
        imgangle1 += 90
        if imgangle1 == 360:
            imgangle1 = 0
  
        if imgangle1 == 90:
            rotq = &quot;-&quot;
        elif imgangle1 == 180:
            rotp = &quot;-&quot;
        elif imgangle1 == 270:
            rotq = &quot;-&quot;
            rotp = &quot;-&quot;
        elif imgangle1 == 0:
            rotq = &quot;&quot;
            rotp = &quot;&quot;
        loadontocanvas(imgangle1)
  
  
    #the name of the default image file displayed when the window first starts up
    defaultimgfile = Label(root, text='PixelCraftLogo.png')
    defaultimgfile.place(x=40, y=30)
  
  
    startupText = Label(root, text='Select an image file to create a blueprint!', font=(&quot;calibri&quot;, 12))
    startupText.place(x=0, y=0)
  
  
  
    imageLabelText = Label(root, text='Image:', font=(&quot;Arial&quot;, 8, 'bold'))
    imageLabelText.place(x=0, y=30)
  
  
    rotateimgbtn = Button(root, text='⭯', style = 'W.TButton', command=rotatetheimg)
  
    importimages1 = Button(root, text='Browse', style = 'W.TButton', command=importimages)
    importimages1.place(x=160, y=30)
  
  
    convertbtn= Button(root, text='Create my files!', style = 'W.TButton', command=filenameinput)
    ent = Entry(root, width=20)
    confbutton = Button(root, text='Confirm', style = 'W.TButton', command=warningmaker)
  
  
    root.mainloop()
  </code></pre>