逆向爬虫|实战!用tkinter做一个能看得过去的界面!爬取某宝商品数据!(一键三连+打赏!!!)
作品展示!!!
【逆向爬虫|实战!用tkinter做一个能看得过去的界面!爬取某宝商品数据!(一键三连+打赏!!!)】
文章图片
部分代码展示
'''
tkinter界面设置
'''
win = tkinter.Tk()
win.title("淘宝数据")
win.geometry("1050x500+40+30")
image2 = Image.open(r'D:\Desktop\C~O)OKLBO]{3H{KE$J4%12M.png')
background_image = ImageTk.PhotoImage(image2)
background_label = Label(win, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
# # 表格
tree = ttk.Treeview(win)
tree.pack()
tree.place(x=0,y=0)
# 定义列
tree["columns"] = ("itemname", "shoptitle", "sellernickname", "promotionprice","price","monthsellcount","provcity","url")
# 设置列,列还不显示
tree.column("itemname", width=100)
tree.column("shoptitle", width=100)
tree.column("sellernickname", width=100)
tree.column("promotionprice", width=50)
tree.column("price", width=50)
tree.column("monthsellcount", width=50)
tree.column("provcity", width=70)
tree.column("url", width=1000)
# 设置表头
tree.heading("itemname", text="产品名称")
tree.heading("shoptitle", text="店名")
tree.heading("sellernickname", text="卖家小名")
tree.heading("promotionprice", text="促销价格")
tree.heading("price", text="原价")
tree.heading("monthsellcount", text="月销量")
tree.heading("provcity", text="发货地")
tree.heading("url", text="网址")
e = tkinter.Variable()
path_entry = tkinter.Entry(win, textvariable=e,width=60)
path_entry.pack()
path_entry.place(x=43, y=260)
e.set("请填写csv文件的绝对路径")
label_num=tkinter.Label(win,text='page_num')
label_num.pack()
label_num.place(x=0,y=230)
label_word=tkinter.Label(win,text='key_word')
label_word.pack()
label_word.place(x=130,y=230)
label_save=tkinter.Label(win,text="保存到")
label_save.pack()
label_save.place(x=0,y=260)
num = tkinter.Entry(win, width=8)
num.pack()
num.place(x=67, y=230)
w = tkinter.Entry(win, width=20)
w.pack()
w.place(x=188, y=230)
button1=tkinter.Button(win,text="退出",command=win.quit)
button1.pack(side="bottom")
button2=tkinter.Button(win,text="一键爬取+保存",command=save_to_csv)
button2.pack()
button2.place(x=450,y=260)
win.mainloop()
私信可发源码!
推荐阅读
- Python爬虫|Python爬虫 --- 1.4 正则表达式(re库)
- 爬虫数据处理HTML转义字符
- 《机器学习实战》高清中文版PDF英文版PDF+源代码下载
- --木木--|--木木-- 第二课作业#翼丰会(每日一淘6+1实战裂变被动引流# 6+1模式)
- 《将来的你,一定会感谢现在战胜烦恼的自己-------第四章/第十一节/用逆向思维解除烦恼》
- 2018-12-05爬虫
- 2020-07-29《吴军·阅读与写作50讲》24实战才能转化效能
- Python实战计划学习笔记(9)为大规模爬取准备
- 韵达基于云原生的业务中台建设 | 实战派
- 【V课会】第3季-30天小学思维导图实战营