本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT.size方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.size方法的具体用法?Python NavigationToolbar2QT.size怎么用?Python NavigationToolbar2QT.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_widget
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import size [as 别名]
class plot_widget(QWidget):
def __init__(self,
parent=None,
title='',
xlabel='',
ylabel='',
width=10,
height=5,
dpi=100,
dimension = '111',
bgcolor = '#262626'
):
QWidget.__init__(self,parent)
self.canvas = mpl_widget(
self,
title = title,
xlabel = xlabel,
ylabel = ylabel,
xlim = None,
ylim = None,
xscale = 'linear',
yscale = 'linear',
width = int(width),
height = int(height),
dpi = int(dpi),
dimension = dimension,
bgcolor = bgcolor,
hold = True)
self.toolbar = NavigationToolbar(self.canvas, None)
self.v_layout = QVBoxLayout()
#============vairables to hold the dialog objects==========
self.fd = None
self.pd = None
#self.canvas.axes.
#==================toolbar gui components==========
#reader button
self.b_read_file = QPushButton("")
icon1 = QIcon()
icon1.addPixmap(QPixmap(":/imag/read_file_2.png"), QIcon.Normal, QIcon.On)
self.b_read_file.setIcon(icon1)
self.b_read_file.clicked.connect(self.b_read_file_clicked)
self.b_read_file.setIconSize(QSize(48, 48));
self.b_plot_data = QPushButton("")
icon1 = QIcon()
icon1.addPixmap(QPixmap(":/imag/plot.png"), QIcon.Normal, QIcon.On)
self.b_plot_data.setIcon(icon1)
self.b_plot_data.clicked.connect(self.b_plot_button_clicked)
self.b_plot_data.setIconSize(QSize(48, 48));
#==============add widgets to toolbar
self.toolbar.addWidget(self.b_read_file)
self.toolbar.addWidget(self.b_plot_data)
#
self.setMinimumSize(self.toolbar.size())
self.setMinimumSize(self.canvas.size())
self.v_layout.addWidget(self.toolbar)
self.v_layout.addWidget(self.canvas)
self.setLayout(self.v_layout)
def b_read_file_clicked(self):
if (self.fd == None):
self.fd = file_dialog()
self.fd.exec_()
else:
self.fd.show()
self.fd.exec_()
def b_plot_button_clicked(self):
if (self.fd == None):
quit_msg = "Please open the file first, its not possible to plot"
reply = QMessageBox.critical(self, 'File First',
quit_msg, QMessageBox.Close)
else:
if (self.pd == None):
self.pd = plot_dialog(self,self.fd)
self.pd.exec_()
else:
self.pd.show()
self.pd.exec_()