Re: Key press events on Canvas



On Fri, 2015-10-30 at 14:24 -0300, John Coppens wrote:
Hi all,

I tried to react on keypress events over a Canvas widget. Though the
code seems right (no compiler complaints), no events are generated.
Button press/release events and Enter/Leave events work fine.

I thought the button press events might be masked out, but even
after    canvas.set_events(Gdk.EventMask.KEY_PRESS_EVENT), no events
appeared.

I'm using GooCanvas 2.0.2 (using introspection), and Python 3.4.3.

Is there any way to detect keypresses?

It should work. There is a page in the demo app to demonstrate it.

Have you set the CAN_FOCUS widget flag, to let GTK+ know the canvas can
take the keyboard focus?

  gtk_widget_set_can_focus (canvas, TRUE);

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]