The following two examples are from Grayson's book on Tkinter. He's making a 
simple dialog with three buttons. In the first example, he does not use the 
Frame class, but in the second he does. Doesn't the first example need a 
container? What's the difference here?

==============5.1============
from Tkinter import *

class App:
     def __init__(self, master):
         Button(master, text='Left').pack(side=LEFT)
         Button(master, text='Center').pack(side=LEFT)
         Button(master, text='Right').pack(side=LEFT)

root = Tk()
root.option_add('*font', ('verdana', 12, 'bold'))
root.title("Pack - Example 1")
display = App(root)
root.mainloop()
==============5.2==============
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()
===============================

-- 
            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

               "I know that this defies the law of gravity, but
                you see, I never studied law." -- Bugs Bunny

                     Web Page: <www.speckledwithstars.net/>


-- 
                          Wayne Watson (Nevada City, CA)

                        Web Page: <speckledwithStars.net>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to