Tkinter. Why the Need for a Frame, or no Frame?

W. Watson wolf_tracks at invalid.com
Sun Feb 17 13:24:51 CET 2008


I did run them both, but not simultaneously. They looked the same to me. I 
should have probably captured both. I'll check for a small one somewhere.

Francesco Bochicchio wrote:
> On Sat, 16 Feb 2008 19:40:51 -0800, W. Watson wrote:
> 
>> from Tkinter import *
>>
>> class App:
>>      def __init__(self, master):
>>          fm = Frame(master)
>>          Button(fm, text='Left').pack(side=LEFT)
>>          Button(fm, text='This is the Center button').pack(side=LEFT)
>>          Button(fm, text='Right').pack(side=LEFT)
>>          fm.pack()
>>
>> root = Tk()
>> root.option_add('*font', ('verdana', 12, 'bold'))
>> root.title("Pack - Example 2")
>> display = App(root)
>> root.mainloop()
> 
> The obvious question is: why don't you run both and see what happens?
> 
> Anyway, Tk() already opens a frame, so in the first example the buttons
> are created inside that frame, while in the second example two frames
> are created: the one creaded by Tk() il left empty but you should see it
> (maybe very small in a corner) if you run the program.
> 
> Ciao
> -----
> FB

-- 
                          Wayne Watson (Nevada City, CA)

                        Web Page: <speckledwithStars.net>



More information about the Python-list mailing list