[PyKDE] Peculiar canvas behavior

greg landrum greglandrum at mindspring.com
Fri Mar 22 15:40:35 GMT 2002

[System details: RH linux 7.1 kernel 2.4.2-2smp, g++ 3.0.3, Python
2.1.1, Qt 3.0.2, PyQT/Sip-3.1rc2]

I'm experiencing some oddness in the way the QCanvas behaves.
The attached script creates a QCanvas and QCanvasView and puts a couple
boxes on the canvas.  The boxes can be deleted by selecting them (left
click) and hitting delete.  Easy enough.

Well... kind of.

There's an if block down around line 82 in the keyboard event handler. 
When that's if 0 (the current state), the deletion code is in the
method.  When this executes, the highlight around the selected box is
removed but the box itself remains on the canvas until another event is

If I put the exact same deletion code in a separate method and call it
there (when line 82 is if 1), the box is immediately deleted.

This has me completely mystified and makes me think something else is
badly wrong in my code.  Is the behavior at least reproducible on other


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mincanvas.py
Type: text/x-python
Size: 2782 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020322/682ee2be/mincanvas.py

More information about the PyQt mailing list