Reputation: 320
I want to use my Xbox controller in Jupyter environment. I initialized controller, there widget said press any button, then, widget started displaying all of my controls. as on Screenshot.
However when i tried to subscribe with observe
method but it didnt notify any at all, tried look into fields of axes
, buttons
, connected
it was empty and False. Perhaps i am using wrong interface or may be widget supports only one observer since all actions are displayed properly on widget display. I attach my code below.
#%%
import ipywidgets.widgets as widgets
from IPython.display import display
c = widgets.Controller(index=0)
display(c)
#%%
def on_change(change):
print("Axes:", c.axes)
print("Buttons:", c.buttons)
c.observe(on_change, names=['axes', 'buttons'])
Upvotes: 0
Views: 19