mcstarioni
mcstarioni

Reputation: 320

Ipywidgets Controller not working properly, fields empty

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. enter image description here

However when i tried to subscribe with observe method but it didnt notify any at all, tried look into fields of axes, buttons, connectedit 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

Answers (0)

Related Questions