猫史档案馆


【Python作品分享】charts【教程贴】

用户:禁止挖坟后果自负禁止挖坟后果自负查看:0 回复:1 评论:0 创建时间:2020-12-02T21:24:49


【作品展示】

center_image

 

【作品介绍】

参赛APP设计

总算撸完代码了熬夜撸代码

 

【作品源代码】

import sys
import os
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)

    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__":
    app = QApplication(sys.argv)
    window = MyCharts()
    sys.exit(app.exec_())

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
禁止挖坟后果自负禁止挖坟后果自负

魔术喵快来看

我搞定了

点赞0


评论