猫史档案馆


【Python作品分享】别问了,就是个绘图(复制是没用的,ui发不了)【作品秀】

用户:玄离俊秀的狼王玄离俊秀的狼王查看:0 回复:0 评论:0 创建时间:2021-04-10T21:53:45


【作品展示】

center_image

 

【作品介绍】

就个ui绘图。。。

 

【作品源代码】

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 页 / 共 0下一页