Question on using the mouse in scrolled list applications

mongo57a at mongo57a at
Thu Oct 10 21:23:07 CEST 2002

Hi all!

What I want to do is use a button to capture the position/value of the
selected item in a scrolled list. So the user selects the item in the list
with a single click of the left mouse button and then clicks a button.
Should be easy - I'm just not getting it......

Created a class (ScrolledList) for a scrolled list which works fine. Created
another class (aaaaa) which populates the list - and it works fine. Created
a handler under ScrolledList (handleList) which should trap the results of
the bind (makeWidgets). Right now, all I'm trying to do is just print out
the value (just testing..) - but my logic is incorrect (actually, I think
that the logic may be correct - it's just in the wrong place...).

class ScrolledList(Frame):
    def __init__(self, options, parent=None):

    def handleList(self, event):
        index = self.listbox.curselection()
        label = self.listbox.get(index)                   # fetch selection
        print "label is ", label

    def makeWidgets(self, options):
        list.bind('<Button-1>', self.handleList)          # set event

Class aaaaa
     def update_strategy_code(self):
        Button(self, text='Update',

     def edit_strategy_code(self):
        print 'info2=',label

Also, how do I make the mouse appear essentially as it does in an MS
environment - namely, the ability to select a range of items using the shift
key in combination with the mouse and the cntl key in combination with the
mouse for the same application?



-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----

More information about the Python-list mailing list