python - How to control frame size with Tkinter and Python2.7? -


i have bigger frame size default, code doesn't work that. doing wrong?

from tkinter import *  class app:      def __init__(self, master):         frame = frame(master, width=600, height=450)         frame.grid()         frame.pack_propagate(0)  # tell frame not let children control size          self.label_file = label(frame, text="enter csv file:")         self.label_encode = label(frame, text="enter encoding:")         self.entry_file = entry(frame)         self.entry_encode = entry(frame)          self.label_file.grid(row=0, sticky=e)         self.label_encode.grid(row=1, sticky=e)         self.entry_file.grid(row=0, column=1)         self.entry_encode.grid(row=1, column=1)  root = tk() root.wm_title("top list") app = app(root) root.mainloop() 

you calling pack_propagate using grid lay out widgets. if you're using grid, must call grid_propagate.

i urge resist temptation this. tkinter programs behave better geometry propagation turned on. if you're trying solve particular layout problem, there better ways solve turn propagation off.

i've used tkinter more couple of decades, , times i've needed turn geometry propagation off can count on 1 hand, fingers left over.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -