-1

I am trying to create a tkinter window with a button that is stuck at the bottom. I want the button to be used to add new items to the window (separate code, not shown here), but always keep the button at the bottom. Something like the following:

import tkinter as tk

m = tk.Tk(className="My window")

create = tk.Button(m, text="Create new item", width=25)

create.grid(row=inf, padx=40, pady=20)

m.mainloop()

except of course tkinter.grid() doesn;t accept inf as a valid value for row=. My question is how can I ensure that even as I add items to the tkinter window, my button will always remain on the bottom.

Math chiller
  • 4,123
  • 6
  • 28
  • 44
  • 1
    An easy way is just make sure the widget you add of `row` is less than `inf`. – jizhihaoSAMA May 16 '20 at 01:49
  • Does this answer your question? [tkinter gui layout using frames and grid](https://stackoverflow.com/a/34277295/7414759) [what-does-weight-do-in-tkinter](https://stackoverflow.com/questions/45847313) – stovfl May 16 '20 at 07:10

1 Answers1

0

You can combine pack and grid.

Your base application could be this


upperframe.pack(side=tk.TOP)


bottomframe.pack(side=tk.BOTTOM)


Within the upperframe use your grid to add buttons and whatever. The bottom frame containing your changing buttons will be stuck there. You can use pack or grid or whatever you like there.

Creating a status bar goes much the same way.