pyopengltk
pyopengltk copied to clipboard
OpenglFrame only takes mouse input tkinter binds and not kebaord binds.
I have noticed that the openglframe supports <Enter>
and <MouseWheel>
but not any keyboard input. Is this something that can be changed?.
Works fine for me in moderngl-window
self._tk.bind("<KeyPress>", self.tk_key_press)
self._tk.bind("<KeyRelease>", self.tk_key_release)
Signature of callback methods are:
def tk_key_press(self, event: tkinter.Event) -> None:
def tk_key_release(self, event: tkinter.Event) -> None:
Or do you mean adding native support for it?
app.bind("<KeyPress>", sys.exit)
does not work at all, but mouse inputs do.
app.bind("<KeyPress>", sys.exit)
does not work at all, but mouse inputs do.
I would never assume this actually working. tkinter might be discarding the callable you are providing for some reason. Bind KeyPress
to your own function instead.
Also it might be better to self.destroy()
, Using sys.exit()
is not good practice.
oh. wait. Are you trying to register the events on the frame itself or using the tk root?
To the frame. I did "<a>", function
and that never worked.