When Python saw the first attempt at the code, which I am guessing was
Because of the first
= (before the
(), this is not valid syntax. Python would guess that you want to make something that looks like
(x=50,y=250,width=30,height=15), and then say that
label1.place should be equal to that. But
(x=50,y=250,width=30,height=15) is not a valid thing.
:= instead of the
= here, like
(x:=50,y:=250,width:=30,height:=15), means to create separate variables
height; set their values; and then also use those values in order to make the tuple
(50, 250, 30, 15).
== instead, like
(x==50,y==250,width==30,height==15), means to compare those variables to see if the values are equal, then make a tuple with the result of those comparisons. This would obviously be wrong in your case, because you did not already have those variables. But it would be legal Python syntax.
Both of these would make the code into valid code that Python can make sense of, and try to run later (it would fix the
SyntaxError - this explains what “syntax” actually means). This is the only kind of error that Python tries to detect ahead of time - anything else that can go wrong, will go wrong when the code actually runs.
In your case, both of these attempts make the code wrong. You do not want to assign anything to
label1.place at all. This
.place is a method, meaning that once you have created
label1, it is code that you can call (like a function) to work with the
label1 (which is a
tk.Label that you made in the previous code). This is the same as when you do
root.geometry("500x500"); or you may have seen other examples, for example calling methods on a string like