# -*- codeing = utf-8 -*-
# @Time: 2022/5/17 19:02
# @Author: 肖佳佳
# @File:GUI.py
# @Software: PyCharm
import webbrowser
from threading import Thread
from tkinter import *
from tkinter import ttk
import tkinter as tk
from PIL import Image,ImageTk
from getData import getLocalData
from DataVisualization import run
# GUI界面设计
# 通过tkinter库设计窗体,依次添加容器和需要的组件。
# 将函数打包进线程
def threadIt(func, *args):
# 创建
t = Thread(target=func, args=args)
# 守护
t.setDaemon(True)
# 启动
t.start()
class UInterface:
def clearTree(self, tree): # 清空表格
x = tree.get_children()
for item in x:
tree.delete(item)
def addTree(self, data, tree): # 新增数据到表格
# i = 0
for subList in data:
print(subList)
tree.insert('', 'end', values=subList)
# i = i + 1
tree.grid()
def searh(self):
self.clearTree(self.treeview) # 清空表格
self.B_0['text'] = '正在努力搜索'
data = getLocalData() # 读取本地数据信息
self.addTree(data, self.treeview) # 将数据添加到tree中
self.B_0['state'] = NORMAL
self.B_0['text'] = '更新榜单'
def centerWindow(self, root, w, h): # 窗口居于屏幕中央 root: root w: 窗口宽度 h: 窗口高度
# 获取屏幕 宽、高
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
# 计算 x, y 位置
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
# 生成界面就调用 数据可视化
run()
def click1(self):
webbrowser.open("热门小说分析.html")
def click2(self):
webbrowser.open("漫画榜单类型统计图.html")
def ui_process(self):
# 生成主窗口
root = Tk()
self.root = root
root.title("腾讯动漫全部作品数据展示") # 修改框体的名字
self.centerWindow(root, 1000, 500)
root.resizable(0, 0) # 将窗口大小设置为不可变
root['highlightcolor'] = 'yellow'
labelframe = LabelFrame(root, width=1000, height=500, background="white")
labelframe.place(x=5, y=5)
self.labelframe = labelframe
# 图片
img = ImageTk.PhotoImage(Image.open(r'./images/Logo.jpg'))
Lab = tk.Label(root, image=img)
Lab.place(x=20, y=25)
B_1 = Button(labelframe, text="数据分析总图", background="white")
B_1.place(x=450, y=25, width=150, height=50)
self.B_1 = B_1
B_1.configure(command=lambda: threadIt(self.click1())) # 按钮绑定单击事件
B_2 = Button(labelframe, text="榜单类型展示图", background="white")
B_2.place(x=650, y=25, width=150, height=50)
self.B_2 = B_2
B_2.configure(command=lambda: threadIt(self.click2())) # 按钮绑定单击事件
# 查询按钮
B_0 = Button(labelframe, text="更新榜单", background = "white")
B_0.place(x=830, y=25, width=150, height=50)
self.B_0 = B_0
B_0.configure(command=lambda: threadIt(self.searh)) #按钮绑定单击事件
# 框架布局,承载多个控件
frameRoot = Frame(labelframe)
frameL = Frame(frameRoot)
frameR = Frame(frameRoot)
self.frameRoot = frameRoot
self.frameL = frameL
self.frameR = frameR
# 表格
columns = ("序号","漫画名称", "作者", "类型", "观看人数","漫画状态")
treeview = ttk.Treeview(frameL, height=18, show="headings", columns=columns)
treeview.column("序号", width=70, anchor='center')
treeview.column("漫画名称", width=210, anchor='center')
treeview.column("作者", width=250, anchor='center')
treeview.column("类型", width=120, anchor='center')
treeview.column("观看人数", width=150, anchor='center')
treeview.column("漫画状态", width=150, anchor='center')
treeview.heading("序号", text="序号") # 显示表头
treeview.heading("漫画名称", text="漫画名称")
treeview.heading("作者", text="作者")
treeview.heading("类型", text="类型")
treeview.heading("观看人数", text="观看人数")
treeview.heading("漫画状态", text="漫画状态")
# 垂直滚动条
VBar = ttk.Scrollbar(frameR, command=treeview.yview)
treeview.configure(yscrollcommand=VBar.set)
treeview.pack()
self.treeview = treeview
VBar.pack(side=RIGHT, fill=Y)
self.VBar = VBar
# 框架的位置布局
frameL.grid(row=0, column=0, sticky=NSEW)
frameR.grid(row=0, column=1, sticky=NS)
frameRoot.place(x=10, y=100)
root.mainloop() #显示主窗口
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Python爬虫+数据可视化+机器学习+推荐算法+聚类算法。 漫画数据分析主要研究用python语言实现腾讯漫画榜单数据可视化分析,漫画平台可以通过对数据分析的不同类型的效果图的观察,直观地得到腾讯漫画中阅览量最高的漫画作品,从而分析出目前漫画市场上最受用户喜爱的漫画类型,平台继而可针对分析结果,制定策略,大力培养更多的漫画作者,创作更多的受用户欢迎的类型的漫画。使用K-Means算法对图像进行聚类,完成对图像的矢量化操作
资源推荐
资源详情
资源评论
收起资源包目录
TencentComics.rar (33个子文件)
TencentComics
TuiJian.py 1KB
data.csv 352KB
GUI.py 5KB
data.json 403KB
main.py 214B
__pycache__
getData.cpython-38.pyc 2KB
GUI.cpython-39.pyc 4KB
DataVisualization.cpython-39.pyc 3KB
GUI.cpython-38.pyc 4KB
getData.cpython-37.pyc 2KB
DataVisualization.cpython-38.pyc 3KB
GUI.cpython-37.pyc 4KB
DataVisualization.cpython-37.pyc 3KB
getData.cpython-39.pyc 2KB
getData.py 3KB
.idea
.gitignore 50B
other.xml 239B
workspace.xml 10KB
misc.xml 310B
modules.xml 285B
inspectionProfiles
profiles_settings.xml 174B
TencentComics.iml 466B
JuLei.py 2KB
images
man1.jpg 108KB
man3.jpg 237KB
man5.jpg 221KB
man4.jpg 174KB
man2.jpg 212KB
Logo.jpg 38KB
man0.jpg 107KB
DataVisualization.py 4KB
data
animeType.csv 462B
peopleNum.csv 44KB
共 33 条
- 1
BlackStar-Coder
- 粉丝: 4485
- 资源: 6
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页