0

How to manage the size of tkinter windows across many display of different sizes For example in a device with resolution 1600x900 I have two adjacent windows with sizes 900x900 and 700x900(side to side)

from tkinter import *
root1=Tk()
root1.geometry("900x900")
root1.geometry("+0+0")
# some labels inside root1 with some width
root2=Tk()
root2.geometry("700x900")
root2.geometry("+900+0")
# some labels inside root2 window with width

root1.mainloop()
root2.mainloop()

If this code is used in a display with resolution 1300x900 some part of the second window gets hidden. I attempted to get resolution of device using root.winfo_screenwidth() and root.winfor_screenheight() but that doesn't solve the problem for managing the size of labels. So is there a way to shrink the whole window to an affordable size along with the labels, buttons and other things without affecting any position of labels.

  • If you go for `root.winfo_screen..` you just need to use the geometry managers right. There are options to resize it with the window. For example `.pack(fill='x')` or `.grid(columnspan=2)` and `.row_configure(1, weight=1)` [for more](https://stackoverflow.com/questions/63536505/how-do-i-organize-my-tkinter-appllication/63536506#63536506) – Thingamabobs Nov 15 '20 at 12:49
  • 1
    In addition you shouldnt use `tk.Tk()` twice, use `tk.Toplevel()` instead. – Thingamabobs Nov 15 '20 at 12:52
  • Does this answer your question? [How do I organize my tkinter appllication?](https://stackoverflow.com/questions/63536505/how-do-i-organize-my-tkinter-appllication) – Thingamabobs Nov 15 '20 at 13:39

0 Answers0