Python 2.3.2 / Tkinter Problem

Peter Abel PeterAbel at gmx.net
Thu Oct 30 10:34:08 EST 2003


"Gary Richardson" <garyr at fidalgo.net> wrote in message news:<vq10ijokpjv2ab at corp.supernews.com>...
> I've just switched to Python 2.3.2 and have encountered a problem that
> causes a program to crash. The program was working with Python 2.2. The code
> below will illustrate the problem. A listbox is created and the mouse
> wheel is used to scroll the entries. The program crashes as soon as the
> mouse wheel is moved. The program appears to work OK otherwise. The problem
> occurs when the program is run within the IDE or from a DOS prompt. I'm
> using ActivePython 2.3.2 on Win98SE. Any suggestions?
> 
> Thanks,
> Gary Richardson
> ----------------------------------------------------------------------
> from Tkinter import *
> 
> class MakeListBox:
>     def __init__(self, parent ):
>         self.lst = Listbox(parent, width=12, bg='lightblue')
>         self.lst.pack(side=LEFT, anchor=N, expand=NO)
>         self.lst.bind('<ButtonPress-1>', self._onMouseButton)
>         self.scroll = Scrollbar(parent, command=self.lst.yview)
>         self.lst.configure(yscrollcommand=self.scroll.set)
>         self.scroll.pack(side=LEFT, fill=Y)
>         parent.bind('<MouseWheel>', self._onMouseWheel)
>         for k in range(30):
>             self.lst.insert(END, str(k))
> 
>     def _onMouseButton(self, event):
>         print self.lst.nearest(event.y)
> 
>     def _onMouseWheel(self, event):
>         print event
> 
> root = Tk()
> MakeListBox(root )
> root.mainloop()

I tried your example under XP-HE and Python 2.2.2 and got
the same result.
What can't understand, I have an application with the same 
MousWheel-event for three lisboxes and it worked always fine.
But now I tried it to see the difference to your program and
it crashed the same way.
So for me it looks as if this is not a problem of Tkinter
or python version. It seems that something has changend concerning
the wheelmouse-driver.
Would be interested in getting some responses.

Regards
Peter




More information about the Python-list mailing list