I'm looking to have a window occupy the width of the screen but not (yet) the height of the screen. I have the root established and working but as far as I can tell the geometry method requires at least a width AND height, not one or the other individually. I would like the window to continue to scale dynamically in height as widgets are added/taken away. There is a starting height of the notebook tab and button
Without the rest of the code for the ReaderUI class shown below, this is what the main method looks like so far...
def main():
root=Tk()
tab_control = ttk.Notebook(root)
first_tab = ttk.Frame(tab_control)
tab_control.add(tab1,text="File 1")
tab_control.pack(expand=1,fill="both")
new_tab_button = Button(tab,text="create new tab", command = lambda: new_tab(tab_control))
new_tab_button.pack(padx = 5, pady = 5)
newUI = ReaderUI(tab1)
width=root.winfo_screenwidth()
height = root.winfo_screenheight()
root.geometry("{}x{}+0+0".format(width,height)
root.resizable(False,False)
root.mainloop()
My question boils down to this: is there a way to have the UI build itself in terms of height (as it would without the geometry method in place) and only establish a width as wide as the screen? Potentially a modification to the line
root.geometry("{}x{}+0+0".format(width,height))
so that height is left unset and free to move.
you can use
Code
root being your
Tk()
instancethen you can lock the x axis by using
Recourse https://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tk8.0a1/winfo.n.html