Python 2.3.2 / Tkinter Problem

G

Gary Richardson

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()
 
P

Peter Abel

Gary Richardson said:
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
 
M

Michael Peuser

Gary Richardson said:
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?

Seems to be nothing special wuth 2.3. It happens after a few wheel turns in
Python 2.2.2/Win2000 as well.
Minimal test program:
----------------------------------
from Tkinter import *

def _onMouseWheel(event):
print event

root = Tk()
root.bind('<MouseWheel>',_onMouseWheel)
root.mainloop()
 
P

Peter Abel

BTW the program stops without an errortrace
but with Return code=-1073741819 and this only
if started from an editor.
Running in a DOS-Box is finishes without any
response and returns to the DOS-Prompt.

Regards
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top