0

I am new to Tkinter and was learning about the grid() geometry manager. I just wanted to ask if there is any way that we can fix the number of columns and rows inside the tkinter window. If there is, please mention as it would help me from writing long tiresome code. Thank you.

Coder
  • 15
  • 6
  • 1
    What exactly do you mean by "fix" — in what sense? How will being able to do this save coding? – martineau Dec 06 '20 at 08:23
  • @martineau By "fix", I want a definite number of columns and rows which have been decided by me before the widgets are placed. And well, I have done some more coding to ensure that the widgets are in the right place. – Coder Dec 07 '20 at 04:18
  • You can't "fix" the number of rows and columns that way — layout management works different from that in tkinter. Just don't assign widgets to a row and/or column that bigger than what you want to allow. – martineau Dec 07 '20 at 06:33
  • @martineau Okay! Thank you very much. – Coder Dec 09 '20 at 16:55

1 Answers1

0

I think you are looking for

root.rowconfigure()

and

root.columnconfigure()

Check the docs: https://tkdocs.com/tutorial/grid.html

Yash Makan
  • 706
  • 1
  • 5
  • 17
  • Yes, that is right. Where can I get more information about them? I mean where can I get its parameters and other option's information. The link you have provided just mentions them. Well, Thank you for answering. – Coder Dec 07 '20 at 04:22
  • You should probably check this post:- https://stackoverflow.com/a/45850468/10566556 – Yash Makan Dec 07 '20 at 06:13
  • Sure! Thanks for replying. – Coder Dec 09 '20 at 16:56