Python - 'TypeError: Place.place_configure() takes from 1 to 2 positional arguments but 3 were given'

Viewed 15

I'm trying to create a button object I can use repeatedly to save time retyping the same attributes, but I can't seem to then set up a grid where I can then place the buttons in different positions and keep getting 'TypeError: Place.place_configure() takes from 1 to 2 positional arguments but 3 were given' tracing back to lines 30 & 34. It's likely a simple fix but I'm not very familiar with tkinter so I'd appreciate any help.

    from tkinter import *
    import tkinter.font as font

    ### Home Page ###

    home = Tk()
    home.geometry('2560x1440')
    home.configure(bg='#FFFFFF')
    home.title('Doe\'s food')

    # Button Font #
    btn_txt = font.Font(size=15, weight="bold", family='Helvetica')

    ## Button ##

    class BTN(Button):
        def __init__(self,text,command,relx,rely):

            # Variables #
            self.text = text
            self.command = command
            self.relx = relx
            self.rely = rely

            # Creation #
            button = Button(home, bd = '12', bg = '#D6D6D6', font = btn_txt)
            button.grid(row=1,column=0)

            # Position #
            button.place(relx,rely)

    # Quit Button #

    Quit_btn = BTN('quit', home.destroy,0.5,0.9)

    Quit_btn.mainloop()

    home.mainloop()
1 Answers

You need to name the parameters:

button.place(x=relx,y=rely)

Related