let my widgets use pack/grid/place
Keith Murphy
kpmurphy at my-deja.com
Mon Aug 7 14:37:37 EDT 2000
does anyone know how to have custom made widgets inherit Widget
qualities, like the ability to pack? it seems like a really simple
thing to do. thanks for your help,
-->keith
In article <8lkds5$q3q$1 at nnrp1.deja.com>,
Keith Murphy <kpmurphy at my-deja.com> wrote:
> ok. here's what i'm trying to do. i want to be able to add a label
to
> anything. here's the class:
>
> class labelify(Widget):
> def __init__(self, master, item, thetext, location):
> frame = Frame(master)
> label = Label(frame, text=thetext)
> item.master = frame
>
> label.pack(side=location)
> item.pack(side=location)
>
> cnf={}
> Widget.__init__(self, master, 'frame', cnf, {})
>
> ...and here's the call:
> entry = labelify(left_frame, Entry(), 'hi', TOP)
> entry.pack()
>
> 1) is that widget extention stuff legal?
> 2) my label disappears, how do i get around that w/o using self
> 3) is there an easier way to do this?
>
> thanks,
> -->keith
>
> In article <8lk8o7$lm8$1 at nnrp1.deja.com>,
> Keith Murphy <kpmurphy at my-deja.com> wrote:
> > how do i let widgets i've created use pack/grid/place?
> >
> > i.e.
> > ...
> > mywidget('schweet')
> > mywidget.pack()
> > ...
> >
> > thanks,
> > -->keith
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list