我想将matplotlib.backends.backends_wx.NavigationToolbar2Wx
添加到我正在开发的GUI中,但是我不希望它出现在FigureCanvas
上,因为这会迫使我的布局变得相当笨拙。有没有一种方法可以将NavigationToolbar2Wx
添加到GUI的另一部分而不是它所附加到的画布上?我特别想要以下的布局
+------------------------------------------------------------------------+
| +--------------------------------------------------------------------+ |
| | | |
| | | |
| | | |
| | | |
| | FigureCanvas | |
| | | |
| | | |
| +--------------------------------------------------------------------+ |
| +--------------------------------------------------------------------+ |
| | TextCtrl TextCtrl NavToolbar TextCtrl Button | |
| +--------------------------------------------------------------------+ |
| |
| More GUI here |
| |
+------------------------------------------------------------------------+
其中FigureCanvas
和它下面的部分在同一个垂直BoxSizer
,带有{BoxSizer
。在
我尝试了各种各样的方法,比如显而易见的构造工具栏,将sizer设置为水平BoxSizer
,并将其添加到BoxSizer
,但是它没有绘制(尽管{, and when I close the window it throws a segfault. If I don't set the sizer for the toolbar, the behavior is identical except it doesn't throw a segfault. I am making sure to call
.Realize()and
.Update()`的位置,但是到目前为止我还没有运气。在
我想做的是可能的,还是必须手动实现按钮和行为?在
扩展一下我的评论,这是一个几乎可以:-)工作的示例,忽略了一些琐碎的部分。我使用
wx.lib.agw.buttonpanel
作为我的工具栏,但是粗糙的任何其他工具也可以。在请注意,您必须自己管理按钮的行为,因为其中一些按钮是只按按钮(fit all,save),有些是切换(缩放,平移),并且是互斥的。。。或者您可以像
NavigationToolbar2Wx
中那样将它们全部保留为按钮。希望这有帮助。在相关问题 更多 >
编程相关推荐