def mybut(text, dummy, xl, yb, xw=0, yh=0, axisbg=None, color=0.85, fun=None, bspace=0.005):
""" create axes and populate button with text, automatically adjusting
xw if not given. Has a side effect on xl. (button_layout_cursor)
dummy is for if and when I can place these on an obect rather than using pylab
"""
if axisbg==None: axisbg='lightgoldenrodyellow'
global button_layout_cursor
if xw==0: xw=0.015*(len(text)+1)
if yh==0: yh=0.05
## thisax=fig.add_axes([xl, yb, xw, yh], axisbg=axisbg) fundamentally wrong
thisax=pl.axes([xl, yb, xw, yh], axisbg=axisbg)
thisbut=Button(thisax, text)
thisbut.on_clicked(fun)
button_layout_cursor += xw+bspace
return(thisbut)
评论列表
文章目录