Designer创建窗体

转化成py文件
略
上代码
import sys
from PyQt5.QtGui import QPainter, QPen
from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtChart import (QChartView, QChart, QBarSeries, QBarSet, QLineSeries, QPieSeries,
QLegend, QBarCategoryAxis, QValueAxis)
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plot.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtChart import QChartView
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.graphicsView = QChartView

本文介绍了如何利用PyQt5的QtChart模块,通过Designer创建窗体,并将其转化为py文件,来实现柱状图和饼状图的绘制。详细步骤包括设计窗体、代码实现以及运行结果的展示。
最低0.47元/天 解锁文章
4695

被折叠的 条评论
为什么被折叠?



