There are three geometry managers: pack, grid, and place. Using one of them is known as mapping
a widget.
Pack and grid cannot be mixed. It's one or the other.
Place can be mixed with pack or grid, but it's really (in my opinion) the last choice because placed
widgets are not detected by the outer frame when it autosizes.
So, because of the above, you were able to mix pack with place and not get an error.
Once you map
something with a geometry manager, can you unmap
and remap
it. So, your first call to d.place()
places
the d widget. But then your second call to d.pack()
overrides the place()
and then packs
the widget.
Because the default for pack()
is side='top', you'll see your four widgets stacked, with a on top, down to d on the bottom.
Also, your app doesn't work right because you create a function hub()
, but you never call it. Add:
if __name__ == '__main__':
hub()
to the bottom of your program.
So, although your posted code is incomplete, try something more like this:
import tkinter
def hub():
newbw=tkinter.Tk()
newbw.attributes('-fullscreen', True)
a=tkinter.Button(newbw, text="demonfight", command=dfpre)
b=tkinter.Button(newbw, text="shop", command=shop)
c=tkinter.Button(newbw, text="train", command=trainhub)
d=tkinter.Button(newbw, text="quit", command=end)
# d.place(x=20, y=20)
a.pack()
b.pack()
c.pack()
d.pack()
if __name__ == '__main__':
hub()