【问题标题】:How to change the text size in a matplotlib Button?如何更改 matplotlib 按钮中的文本大小?
【发布时间】:2017-06-08 13:27:05
【问题描述】:

我在 matplotlib 中有一个按钮,即

myButton = Button(axpos, 'This is a button')

如何让按钮内的文字变小?

【问题讨论】:

    标签: python matplotlib matplotlib-widget


    【解决方案1】:

    要更改 matplotlib 文本的字体大小,请使用 text.set_fontsize(12)。 要获取按钮的文本,请使用myButton.label

    将两者结合起来:

    myButton.label.set_fontsize(12)
    

    【讨论】:

      【解决方案2】:

      使用这个:myButton.label.set_fontsize('smaller') 或者你可以输入你想要的特定尺寸:myButton.label.set_fontsize(10)

      【讨论】:

        猜你喜欢
        • 2020-05-13
        • 2021-01-29
        • 2017-03-09
        • 2015-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-08
        • 2012-09-11
        相关资源
        最近更新 更多