python - tk: do I need to mention the widget master? -


i want rearrange frames in panedwindows @ runtime based upon user request. specified master each frame (here pw1). ex:

import tkinter tk  root = tk.tk()  pw1 = tk.panedwindow(orient=tk.horizontal, sashpad=2,     sashwidth=4, sashrelief=tk.raised) pw1.pack(fill=tk.both, expand=1)  frame1 = tk.frame(pw1, bg='red',width=100, height=100)  frame2 = tk.frame(pw1, bg ='yellow',width=100,height=100)  # seems same thing: # frame1 = tk.frame(bg='red',width=100, height=100) # vs. tk.frame() # frame2 = tk.frame(bg ='yellow',width=100,height=100)   pw1.add(frame1, sticky=tk.nsew) pw1.add(frame2, sticky=tk.nsew)  root.mainloop() 

what advantage of specifying master?

the master paremeter can interpreted parent. passing add new key in parent.children attribute.

if print pw1.children when not pass master and not execute pw1.add() see returns empty dictionary.

print pw1.children #{} 

the pw1.add() method includes added widget in pw1.children dictionary. still did not understand why when pass master widgets not automatically shown.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -