本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT.setMaximumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.setMaximumWidth方法的具体用法?Python NavigationToolbar2QT.setMaximumWidth怎么用?Python NavigationToolbar2QT.setMaximumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.setMaximumWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import setMaximumWidth [as 别名]
class Window(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.shot = None #opened shot
self.folder_name = '' #folder to search for shots
self.current_num = 0 #current diagram
self.currently_selected = None #selected point plot
self.selected_points = OrderedSet() #point to be added
self.current_point = None #plot of current point
self.overall_selected = None #points added to selected list
#super(Window, self).__init__(parent)
# a figure instance to plot on
self.figure = plt.figure()
# this is the Canvas Widget that displays the `figure`
# it takes the `figure` instance as a parameter to __init__
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(parent)
self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
self.canvas.setFocus()
self.canvas.setMinimumSize(500, 0)
self.canvas.mpl_connect('pick_event', self.on_pick)
self.canvas.mpl_connect('motion_notify_event', self.on_move)
self.canvas.hide()
# this is the Navigation widget
# it takes the Canvas widget and a pa rent
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
# Show files widget
self.files = QtGui.QListWidget()
self.files.itemDoubleClicked.connect(self.select_file)
self.files.setMaximumSize(200, 100000)
self.files.setMinimumSize(100, 0)
self.files.hide()
# Show selected points
self.points = ThumbListWidget(self)
#self.points.itemDoubleClicked.connect(self.unselect_point)
self.points.itemClicked.connect(self.points_clicked)
self.points.itemDoubleClicked.connect(self.points_doubleclicked)
self.points.setMaximumSize(200, 100000)
self.points.setMinimumSize(100, 0)
self.points.hide()
#Show diagram widget
self.diagrams = QtGui.QListWidget()
self.diagrams.itemClicked.connect(self.select_item)
self.diagrams.setMaximumSize(250, 100000)
self.diagrams.setMinimumSize(190, 0)
self.diagrams.hide()
#save result button
self.save_button = QtGui.QPushButton('Add time point', self)
self.save_button.clicked.connect(self.add_time)
self.save_button.hide()
#filter menu
self.filters_button = QtGui.QPushButton('Manage filters', self)
self.filters_button.clicked.connect(self.show_filters)
self.filters_button.hide()
self.filters = OrderedDict
self.read_filters()
#diagramms
self.bottom_layout = QtGui.QGridLayout()
self.diagrams_figure = plt.figure()
self.diagrams_canvas = FigureCanvas(self.diagrams_figure)
self.diagrams_canvas.setParent(parent)
self.diagrams_canvas.setMinimumSize(250, 250)
self.diagrams_canvas.setMaximumSize(500, 500)
self.diagrams_toolbar = NavigationToolbar(self.diagrams_canvas, self)
self.diagrams_toolbar.setMaximumWidth(250)
self.diagrams_ax = self.diagrams_figure.add_subplot(111)
self.diagrams_ax.set_ylim(ymin=0)
self.diagrams_ax.set_xlim(xmin=0)
self.diagrams_canvas.draw()
self.enlargre_button = QtGui.QPushButton('Enlarge diagram', self)
self.enlargre_button.clicked.connect(self.enlarge_diagram)
self.bottom_layout.addWidget(self.diagrams_toolbar, 0, 2)
self.bottom_layout.addWidget(self.diagrams_canvas, 1, 2, QtCore.Qt.AlignRight)
self.bottom_layout.addWidget(self.enlargre_button, 0, 1)
# set the layout
self.layout = QtGui.QGridLayout()
self.layout.addWidget(self.filters_button, 0, 1)
self.layout.addWidget(self.toolbar, 0, 2)
self.layout.addWidget(self.canvas, 1, 2)
self.layout.addWidget(self.diagrams, 1, 1)
self.layout.addWidget(self.files, 1, 0)
self.layout.addWidget(self.points, 1, 3)
self.layout.addWidget(self.save_button, 0, 3)
self.layout.addLayout(self.bottom_layout, 2, 2)
self.setLayout(self.layout)
#.........这里部分代码省略.........