# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ChooseUI.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtCore import *
import pandas as pd
from pyecharts import Geo,Line,Bar
from pyecharts import Overlap
import jieba
from wordcloud import WordCloud, ImageColorGenerator
import matplotlib.pyplot as plt
import sys
from os import path
import urllib.request
import collections
import json
import os
import imageio
import re
# 显示热力图,主要城市评论数_平均分页面
class MainWindows(QMainWindow):
def __init__(self):
super(QMainWindow,self).__init__()
self.setGeometry(200, 200, 1250, 650)
self.browser = QWebEngineView()
def kk(self,title,hurl):
self.setWindowTitle(title)
url = d+'/'+hurl
self.browser.load(QUrl(url))
self.setCentralWidget(self.browser)
# 显示词云图片页面
class MainWindowy(QMainWindow):
def __init__(self):
super(QMainWindow,self).__init__()
self.setGeometry(200, 200, 650, 650)
self.browser = QLabel()
def kk(self,title,hurl):
self.setWindowTitle(title)
url = d+'/'+hurl
# self.browser.setBackgroundRole()
# 理由pixmap解析图片
pixmap = QPixmap(url)
# 等比例缩放图片
scaredPixmap = pixmap.scaled(QSize(600, 600), aspectRatioMode=Qt.KeepAspectRatio)
# 设置图片
self.browser.setPixmap(scaredPixmap)
# 判断选择的类型 根据类型做相应的图片处理
self.browser.show()
self.setCentralWidget(self.browser)
# 主窗体
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(382, 206)
self.horizontalLayoutWidget = QtWidgets.QWidget(Form)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(70, 20, 251, 51))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(self.horizontalLayoutWidget)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.comboBox = QtWidgets.QComboBox(self.horizontalLayoutWidget)
self.comboBox.setDuplicatesEnabled(False)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.horizontalLayout.addWidget(self.comboBox)
self.pushButton = QtWidgets.QPushButton(self.horizontalLayoutWidget)
self.pushButton.setObjectName("pushButton")
self.horizontalLayout.addWidget(self.pushButton)
self.verticalLayoutWidget = QtWidgets.QWidget(Form)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(80, 80, 235, 89))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName("label_2")
self.horizontalLayout_2.addWidget(self.label_2)
self.pushButton_2 = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.pushButton_2.setObjectName("pushButton_2")
self.horizontalLayout_2.addWidget(self.pushButton_2)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.horizontalLayout_3.addWidget(self.label_3)
self.pushButton_3 = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.pushButton_3.setObjectName("pushButton_3")
self.horizontalLayout_3.addWidget(self.pushButton_3)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
self.label_4.setObjectName("label_4")
self.horizontalLayout_4.addWidget(self.label_4)
self.pushButton_4 = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.pushButton_4.setObjectName("pushButton_4")
self.horizontalLayout_4.addWidget(self.pushButton_4)
self.verticalLayout.addLayout(self.horizontalLayout_4)
self.hide()
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
# 隐藏查看内容
def hide(self):
self.pushButton_4.setVisible(False)
self.label_4.setVisible(False)
self.pushButton_3.setVisible(False)
self.label_3.setVisible(False)
self.label_2.setVisible(False)
self.pushButton_2.setVisible(False)
# 显示查看内容
def show(self):
self.pushButton_4.setVisible(True)
self.label_4.setVisible(True)
self.pushButton_3.setVisible(True)
self.label_3.setVisible(True)
self.label_2.setVisible(True)
self.pushButton_2.setVisible(True)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "开心麻花影视作品分析"))
self.label.setText(_translate("Form", "选择电影:"))
self.comboBox.setItemText(0, _translate("Form", "夏洛特烦恼"))
self.comboBox.setItemText(1, _translate("Form", "羞羞的铁拳"))
self.comboBox.setItemText(2, _translate("Form", "西虹市首富"))
self.pushButton.setText(_translate("Form", "分析"))
self.label_2.setText(_translate("Form", "主要城市评论数及平均分"))
self.pushButton_2.setText(_translate("Form", "查看"))
self.label_3.setText(_translate("Form", " 热力图"))
self.pushButton_3.setText(_translate("Form", "查看"))
self.label_4.setText(_translate("Form", " 词云"))
self.pushButton_4.setText(_translate("Form", "查看"))
# 电影选择事件
self.comboBox.activated[str].connect(self.itemchange)
# 分析功能
self.pushButton.clicked.connect(self.anal)
# 判断是否有词云图片
if not os.path.isfile(d + '夏洛特烦恼词云.png'):
self.pushButton.setText('分析')
self.hide()
else:
self.pushButton.setText('完成重新分析')
self.moveName = '夏洛特烦恼'
self.moveId = '246082'
self.show()
self.btnclick()
# 绑定电影选择处理方法
def itemchange(self,text):
# 判断下拉列表改变后的内容是什么
if text =='夏洛特烦恼':
# 判断文件是否存在
if not os.path.isfile(d + '夏洛特烦恼词云.png'):
yxkfw
- 粉丝: 81
- 资源: 2万+
最新资源
- 回调函数的概念、实现与应用场景详解
- MapReduce基础实战:从理论到实践-掌握分布式计算核心技术
- 定制红米note8-ginkgo-魅族flyme安卓10-fast线刷 无root固件
- 尚硅谷大数据技术之新能源汽车数仓-网盘下载.txt
- 1.《数据结构》课程设计任务书-班级-第X组-学号-姓名.docx
- 007-基于LED数码管的矩阵键值采集带按键音proteus仿真.rar
- 为iperf2 输出结果加上时间戳信息,方便对带宽变化或流量异常问题进行回溯和分析
- 安卓开发课程设计Android音乐播放器项目源码+图片展示(高分项目)
- 逻辑教育Logic-iOS高级强化班-价值4088元-资料齐-网盘下载.txt
- 嵌入式学习笔记:实验五AD采集系统设计(dma方式,采集的电压数据通过串口在串口屏上显示)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页