web123456

Python's basic tkinter interface crawler collection (supplement and improvement of page turn function)

  • """
  • # @Current time: 2024/8/19 13:08
  • # @Author : TS
  • # @Email : TS@
  • # @File :
  • # @Software: PyCharm
  • """
  • import math
  • from import ThreadPoolExecutor
  • from tkinter import filedialog, messagebox
  • from slider_tk import Slider_tk
  • from slider_kz import Slide_kz
  • from slider_kz import Fart_pi
  • from dj_zk import Yj_youyou
  • class Slider_subassembly(Slider_tk):
  • def __init__(self, root=None):
  • super().__init__(root=root)
  • = root
  • = Slide_kz()
  • = Fart_pi()
  • = Yj_youyou()
  • self.submit_button_dj.config(command=self.dj_searcj)
  • self.submit_button.config(command=self.on_submit)
  • self.submit_button2.config(command=self.on_submt)
  • self.submit_button_pe.config(command=)
  • ("<Button-1>", self.on_tree_click)
  • ()
  • #
  • def show(self):
  • self.(x=10, y=20, )
  • self.Labe_lFram6.place(x=2, y=190, width=400, height=5)
  • self.Labe_lFram5.place(x=2, y=110, width=400, height=5)
  • self.Labe_lFram4.place(x=2, y=150, width=400, height=5)
  • self.Labe_lFram3.place(x=2, y=1, width=997, height=50)
  • self.Labe_lFrame.place(x=2, y=50, width=400, height=448)
  • self.Labe_lFram2.place(x=400, y=50, width=600, height=440)
  • (x=4, y=80, )
  • (x=100, y=80)
  • self.submit_button.place(x=340, y=78,)
  • self.(x=4, y=125, )
  • self.(x=100, y=125)
  • self.submit_button2.place(x=340, y=120, )
  • (x=404, y=68, height=418, width=593, )
  • # Bind the mouse click event
  • self.label_dj.place(x=4, y=165)
  • self.label_pa.place(x=4, y=210)
  • self.entry2_dj.place(x=80, y=165)
  • self.entry2_pa.place(x=80, y=210)
  • self.submit_button_dj.place(x=270, y=160)
  • self.submit_button_pe.place(x=340, y=210)
  • def search_(self):
  • ['columns'] = ('serial', 'id', 'singer', 'name', 'url')
  • for col in ['columns']:
  • (col, text=col)
  • ('serial', width=2, )
  • ('id', width=2, )
  • ('singer', width=2)
  • ('name', width=2, )
  • ('url', width=2, )
  • n=0
  • params = ()
  • pase = (params)
  • dict_ =(pase)
  • for di_ct in dict_:
  • id = di_ct['id']
  • song_name = di_ct['song_name']
  • singer = di_ct['singer']
  • url_ = di_ct['url']
  • ("", "end", values=(n, id, singer,song_name, url_))
  • n+=1
  • def Page(self):
  • Page = self.entry2_pa.get()
  • (*.get_children())
  • self.dj_searcj(Page)
  • def dj_searcj(self,page=None):
  • ['columns'] = ('serial', 'id','name','time', 'Number of Pages', 'url')
  • for col in ['columns']:
  • (col, text=col)
  • ('serial', width=2, )
  • ('id', width=2, )
  • ('Number of Pages', width=2)
  • ('name', width=2, )
  • ('time', width=2, )
  • ('url', width=2, )
  • n = 0
  • params = self.entry2_dj.get()
  • pase = (params,page)
  • dict_ = .url_dq(pase)
  • for i in dict_:
  • name = i['name']
  • Pages = i['Recording'] #Page number
  • li_url = i['li_url']
  • id_st = i['id_st']
  • time_s=i['time_s']
  • divisor = 20
  • result = (int(Pages) / divisor)
  • # print(n, id_st, name,time_s,result,li_url)
  • ("", "end", values=(n, id_st, name,time_s,result,li_url))
  • n += 1
  • def on_tree_cli(self):
  • ['columns'] = ('serial', 'id', 'singer', 'name', 'url')
  • for col in ['columns']:
  • (col, text=col)
  • ('serial', width=2, )
  • ('id', width=2, )
  • ('singer', width=2)
  • ('name', width=2, )
  • ('url', width=2, )
  • n=0
  • params = self.()
  • pase=(params)
  • dict_=(pase)
  • for di_ct in dict_:
  • id = di_ct['songid']
  • song_name = di_ct['author']
  • singer = di_ct['title']
  • url_ = di_ct['Location']
  • ("", "end", values=(n, id, singer, song_name, url_))
  • n += 1
  • def on_tree_click(self, event):
  • if == :
  • # Get the double-click item
  • item = .identify_row()
  • if item:
  • # Get the values ​​of the item
  • values = (item, "values")
  • # # Assume values ​​are a tuple that contains the song's id, song_name, singer, url and other information
  • url = values[-1]
  • song_name = values[2]
  • download_message = "Download or not"
  • if ("Download",download_message):
  • .save_mp3(url,song_name)
  • # ("Download_messa")
  • ("Downloaded", song_name)
  • def on_submit(self):
  • (*.get_children()) # Clear tree control data
  • self.search_() # Pass in the callback function
  • def on_submt(self):
  • (*.get_children()) # Clear tree control data
  • self.on_tree_cli() # Pass in the callback function
  • def dj_submt(self):
  • (*.get_children()) # Clear tree control data
  • self.dj_searcj()