importmatplotlib.pyplotaspltfig=plt.figure()fig.canvas.manager.set_window_title('Hello world!')plt.show() 运行: 为便于检索,文章收录于:
self.pushButton.clicked.connect(self.cao) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton.setText(_translate("MainWindow", "123123")...
MainWindow.setWindowTitle(_translate("MainWindow","MainWindow")) self.label.setText(_translate("MainWindow","时间范围:")) self.start_dateTimeEdit.setDisplayFormat(_translate("MainWindow","yyyy/MM/dd HH:mm")) self.label_2.setText(_translate("MainWindow","--")) self.end_dateTimeEdit.set...
self.setWindowTitle("Demo14_1, GUI中的matplotlib绘图") ## rcParams[]参数设置,以正确显示汉字 mpl.rcParams['font.sans-serif']=['KaiTi','SimHei']#汉字字体 mpl.rcParams['font.size']=12#字体大小 mpl.rcParams['axes.unicode_minus']=False#正常显示负号 self.__iniFigure()#创建绘图系统,初始化...
self.setWindowTitle(title) self.setGeometry(top, left, width, height) self.MyUI 在这个方法中,我们创建了一个带有两个QPushButton的Canvas。 defMyUI(self): canvas = Canvas(self, width=8, height=4) canvas.move(0,0) button = QPushButton("点击我", self) ...
self.setWindowTitle("matlplotlib学习") def init(self): self.static_canvas = FigureCanvas(Figure(figsize=(5, 3))) layout = QtWidgets.QVBoxLayout(self.groupBox_1) layout.addWidget(self.static_canvas) self._static_ax1,self._static_ax2 = self.static_canvas.figure.subplots(2,1) ...
class Ui_MainWindow(QtGui.QMainWindow): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(690, 427) self.centralWidget = QtGui.QWidget(MainWindow) self.centralWidget.setObjectName(_fromUtf8("centralWidget")) ...
setWindowTitle("matplotlib 图形 嵌入 PyQt5") def replot(self, x, y): self.myfigure.update_figure(x,y) qApp = QtWidgets.QApplication(sys.argv) ui = Widget() ui.show() sys.exit(qApp.exec_()) 下面这个例子来自官网,稍微复杂一点点,我仅添加了一点中文注释。 代码语言:javascript 复制 from...
mCH, subItem.mItem, subItem.mSubNames[i] ) ) self._dynamic_ax.legend() self._dynamic_ax.figure.canvas.draw() if __name__ == "__main__": qapp = QtWidgets.QApplication(sys.argv) app = ApplicationWindow() app.show() app.setWindowTitle( "Mega Plot" ) qapp.exec_() ...
win = gtk.Window() win.connect("destroy", lambda x: gtk.main_quit()) win.set_default_size(400,300) win.set_title("Embedding in GTK") vbox = gtk.VBox() win.add(vbox) fig = Figure(figsize=(5,4), dpi=100) ax = fig.add_subplot(111) ...