猫史档案馆


【Python作品分享】图表分析软件主程序·主程序【作品秀】

用户:碳查看:0 回复:2 评论:0 创建时间:2019-12-13T22:25:41


【作品展示】

center_image

 

【作品介绍】

它可以解决一些办公,经济和考试成绩测评分析的问题哦~

本作品为主作品,然后会继续发两个帖子的哦~

康康这俩帖子叫啥:

图表分析软件主程序·程序1

图表分析软件主程序·程序2

注意!!!

先运行程序1,再运行主程序哦!!!

(本碳QQ:1245996904,有事找事,没事找茬~QWQ)

 

【作品源代码】

import os
import sys

from PySide2.QtWidgets import *
from ui_charts import Ui_Charts
from plots import plots
from PySide2.QtCore import QUrl
from PySide2.QtWebEngineWidgets import QWebEngineView

class MyCharts(QMainWindow, Ui_Charts):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.init_set()
        self.show()


        self.pbtn_data.clicked.connect(self.select_file)
        self.cb_chart_list.currentIndexChanged.connect(self.plot)
    
    def init_set(self):
        self.browser = QWebEngineView()
        self.vl_chart.addWidget(self.browser)

    def select_file(self):
        self.data_file, _ = QFileDialog.getOpenFileName(
            caption="选择数据文件", filter="(*.json)")
        self.lb_info.setText(self.data_file)
        self.plot()
    
    def plot(self):
        index_text = self.cb_chart_list.currentText()
        if self.data_file:
            plots(self.data_file, index_text)
            self.browser.load(QUrl.fromLocalFile(os.path.realpath("render.html")))

if __name__ == "__main__":  #Py文件是被调用的还是作为模块的判断
    app = QApplication(sys.argv)    #自己运行就成立
    window = MyCharts()             #否则会返回文件名
    sys.exit(app.exec_())

#自己运行name会返回main,作为模块被使用就返还py文件的名字,如plots。

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
QBZ_QBZ_

可以封装成exe

点赞0


评论


QBZ_QBZ_

具体见https://shequ.codemao.cn/community/199565

点赞0


评论