Newbie question
John E. Garrott
johnga at primenet.com
Sat Jun 19 21:35:53 EDT 1999
Hans Nowak wrote:
>
> On 19 Jun 99, John E. Garrott wrote:
>
> > I am have a problem with the program below.
> > The intent is, eventually, to get a list and display it,
> > in a list box, then print the selected row
> > from the listbox, but I can't get the callback
> > to work.
> >
> > The function dbs.databases() works, putting,
> > in this case, the databases owned by myself
> > into the listbox. When I click on the listbox
> > items they highlight as expected, but, apparently,
> > list_cb() is never called.
> >
> > I've read all the available literature on
> > binding and signals, tried numerous variations
> > on what is here. No results. This program
> > shows no errors, so is syntactically(sp?)
> > correct. Just doesn't work.
> >
> > What am I doing wrong?
> >
> > Thanks in advance,
> >
> > John
> > --------------------------------------------------------
> > import dbs
> > import string
> > from Tkinter import *
> >
> > class SelectionBox:
> >
> > def __init__(self, master=None):
> > self.frame = Frame(master, name="frame")
> > self.frame.pack(expand=1, fill=BOTH)
> >
> > self.frame.listbox = Listbox(self.frame, name='listbox')
> > self.frame.listbox.pack(expand=1, fill=BOTH)
> > self.frame.listbox.bind('Button-1', self.list_cb)
> >
> > for item in dbs.databases():
> > self.frame.listbox.insert(END, item)
> >
> > def list_cb(event):
> > print "Here we are!"
>
> I don't know for sure, but shouldn't this be
>
> def list_cb(self, event):
>
> ?
>
> I don't know if that's the solution for your problem, though... It's
> not like *I* know much about Tkinter. :o)
>
> Veel liefs,
>
> --Hans Nowak (ivnowa at hvision.nl)
> Homepage: http://fly.to/zephyrfalcon
I believe you are right, but that doesn't work either. No errors, but
also
no action.
Thanks for your reply,
John
More information about the Python-list
mailing list