You should just use 'pack' properly.  Namely, the fill= and expand=
parameters.  In this case, you want to pack(fill=BOTH, expand=YES).
For the button, you may want to use pack(anchor=E) or anchor=W to make
it stick to one side of the window.

The additional parameters for the button (both creation and packing)
give a geometry that is closer to the standard buttons in Windows 95
/ Windows 2000.  Use those or not, as you see fit.

Here's the new program:

from Tkinter import *

class testApp2:
     def __init__( self, master ):
         self.ma = master
         self.f = Frame( self.ma )
         self.f.pack(fill=BOTH, expand=YES)
         self.cv = Canvas(self.f, width=25, height=25, bg='red')
         self.cv.pack(fill=BOTH, expand=YES)
         self.b1 = Button( self.f, text='Hello', height=1, width=10,
                            padx=0, pady=1)
         self.b1.pack(side=BOTTOM, anchor=E, padx=4, pady=4)



root = Tk()
app = testApp2(root)
root.mainloop()

Jeff
PS thanks for including a full, runnable program in your post!

Attachment: pgpqy4uUUgiLH.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to