Reputation: 94
When running this code involving tkinter.place():
from tkinter import *
HEIGHT = 500
WIDTH = 800
MID_X = HEIGHT/2
MID_Y = WIDTH/2
...
window = Tk()
...
def main_menu():
...
label.place(MID_X, MID_Y)
button.place(HEIGHT-50, MID_Y)
...
main_menu()
window.mainloop()
The code fails with a TypeError
:
Traceback (most recent call last):
File "/Users/.../program.py", line 22, in <module>
main_menu()
File "/Users/.../program.py", line 19, in main_menu
label.place(MID_X, MID_Y)
TypeError: place_configure() takes from 1 to 2 positional arguments but 3 were given
(I'm not telling you the full file path, for privacy reasons.)
But only 2 arguments were given! The documentation does not say anything about this. How can this be fixed?
Upvotes: 0
Views: 432
Reputation: 385900
place
generally needs named arguments.
label.place(x=MID_X, y=MID_Y)
Upvotes: 2