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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -