'Place ipywidget Dropdown on screen in matplotlib.pyplot axes ax1
When I run this code, the Dropdown is nowhere to be found. How do I make it appear in ax1? (I think I would like to avoid Tkinter.)
#!/usr/bin/env python3
#Place ipywidget Dropdown on screen in matplotlib.pyplot axes ax1
import matplotlib.pyplot as plt
from ipywidgets.widgets import Dropdown, Layout
fig = plt.figure()
axcolor = 'lightgoldenrodyellow'
# I want a fig with 1 axes--left rectangle with Dropdown (later I will have 4 other axes)
# instance the axes [left, bottom, width, height].
ax1 = fig.add_axes([.1, .4, .4, .4]) #([.92, .97, .08, .03])
# Dropdown is from ipywidgets
def STypeGrp_event_handler(change):
print(change.new)
STypeGrp.value = ""
STypeGrp = Dropdown(
options=list(['E1', 'E2', 'F1']),
value='E1',
description='Type-Grp:',
layout=Layout(width='100px', margin = '20px 20px 20px 20px')
)
STypeGrp.observe(STypeGrp_event_handler)
#widgets.interact(STypeGrp_event_handler, value=STypeGrp)
plots = [STypeGrp]
# ?? How do I put STypeGrp dropdown into the ax1 frame??
figManager = plt.get_current_fig_manager()
figManager.window.showMaximized()
plt.show()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
