Skip to content

scene.kb.getkey segfault and related issues #9

@JohnDenker

Description

@JohnDenker

Consider the following simple program

#! /usr/bin/python

from __future__ import print_function
from visual import *

while 1:
  rate(30)
  if scene.kb.keys:       # check for key event
    s = scene.kb.getkey() # get keyboard info
    print("len:", len(s))
    if len(s):
      print("key event '", s, "'")

Observed behavior:

  1. For the shift, ctrl, and alt keys on the left side of the keyboard, when pressed by themselves, kb.keys sees no events at all.

  2. The shift, ctrl, and alt keys on the right side of the keyboard, kb.getkey returns a zero-length string.

  3. For the keys XF86WakeUp (151), XF86Back (165), and XF86Forward (166), kb.getkey produces a segmentation fault. This is 100% reproducible chez moi. A stack trace is attached.
    stacktrace.txt

Desired behavior:

  1. It would be very useful to have a way of knowing whether or not each shift, ctrl, and alt key is down at any given time. The existing kb.keys / kb.getkey interface does not attempt to provide this information. I could not find any alternative interface that did.

  2. Specific suggestion, it would be nice to have some way to obtain the standard "event" structures, including standard keyup / keypress / kendown events, via the polling interface.

  3. The event-driven interface would be even better, but that only works in vpython 6, which is not presently supported on linux platforms. And no, my users are not going to install wine.

  4. Not segfaulting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions