On Jun 10, 2:36 pm, Rick Johnson <rantingrickjohn...@gmail.com> wrote:

> #
> # Or become a pro and create reusable objects!
> #
> class LE(tk.Frame):
>     def __init__(self, master, **kw):
>         tk.Frame.__init__(self, master)
>         self.l = tk.Label(self, **kw)
>         self.l.pack(side=LEFT)
>         self.e = tk.Entry(self)
>         self.e.pack(side=LEFT, fill=X, expand=YES)
> root = tk.Tk()
> root.title('Pro')
> for x in range(10):
>     le = LE(root, text="Field_"+str(x))
>     le.pack(fill=X, expand=YES)
> root.mainloop()

PS: The keywords argument should have been passed to the entry widget
and NOT the label. Yes, occasionally, even pros make subtle mistakes.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to