OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

how to set fixed frame sizes in python tkinter

  • Thread starter Thread starter user6729368
  • Start date Start date
U

user6729368

Guest
say i have a tkinter window with two separate frames that i want to fill with info, my only problem is that the frame size sets itself dynamcally. my windows size is 500 by 500 and i want the top frame to go from 0,0 to 250,250. and the bottom from 0,250 to 500,500. I think you might get the idea at this point

here is my code so far:

Code:
def main_game(username,password,new_u,old_u):
    Tk_window_center(500,500)
    root.resizable(width=False, height=False)
    ##
    if new_u =="":
        pass
    else:
        new_u.pack_forget()
    if old_u =="":
        pass
    else:
        old_u.pack_forget()
    ##
    output_window_frame=Frame(root, bg="black")
    user_terminal_frame=Frame(root)
    ##
    usr_output=Label(output_window_frame)
    user_inp=Entry(user_terminal_frame)
    user_term=Label(user_terminal_frame)
    ##
    output_window_frame.grid(row=0,column=0,rowspan=3,columnspan=3, sticky="NSEW")

    user_terminal_frame.grid(row=4,column=0,rowspan=3,columnspan=3, sticky="NSEW")
    user_inp.pack(side="top", fill="x")
    user_term.pack(side="bottom", fill="x")

p.s. new_u and old_u are previous frames that activate on startup
<p>say i have a tkinter window with two separate frames that i want to fill with info, my only problem is that the frame size sets itself dynamcally. my windows size is 500 by 500 and i want the top frame to go from 0,0 to 250,250. and the bottom from 0,250 to 500,500. I think you might get the idea at this point</p>

<p>here is my code so far:</p>

<pre><code>def main_game(username,password,new_u,old_u):
Tk_window_center(500,500)
root.resizable(width=False, height=False)
##
if new_u =="":
pass
else:
new_u.pack_forget()
if old_u =="":
pass
else:
old_u.pack_forget()
##
output_window_frame=Frame(root, bg="black")
user_terminal_frame=Frame(root)
##
usr_output=Label(output_window_frame)
user_inp=Entry(user_terminal_frame)
user_term=Label(user_terminal_frame)
##
output_window_frame.grid(row=0,column=0,rowspan=3,columnspan=3, sticky="NSEW")

user_terminal_frame.grid(row=4,column=0,rowspan=3,columnspan=3, sticky="NSEW")
user_inp.pack(side="top", fill="x")
user_term.pack(side="bottom", fill="x")
</code></pre>

<p>p.s. new_u and old_u are previous frames that activate on startup</p>
Continue reading...
 

Latest posts

Top