Guest User

Untitled

a guest
Aug 8th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. # create archive frame & search bar
  2. self.archiv_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
  3. self.archiv_frame.rowconfigure(1, weight=1)
  4. self.archiv_frame.columnconfigure(0, weight=1)
  5. self.archiv_frame_scrollable_button_frame = ScrollableLabelButtonFrame(master=self.archiv_frame, width=300, corner_radius=0, command=self.archiv_button_reprint_event)
  6. self.archiv_frame_scrollable_button_frame.grid(row=1, column=0, columnspan=2, padx=20, pady=20, sticky="nsew")
  7.  
  8. self.archiv_frame_search_entry = customtkinter.CTkEntry(self.archiv_frame)
  9. self.archiv_frame_search_entry.grid(row=0, column=0, padx=20, pady=[20, 0], sticky="ew")
  10.  
  11. self.search_button = customtkinter.CTkButton(self.archiv_frame, text="Suchen", image=self.search_image, command=self.search_archive_thread)
  12. self.search_button.grid(row=0, column=1, padx=[0, 20], pady=[20, 0], sticky="e")
  13.  
  14. def search_archive_thread(self):
  15. t = threading.Thread(target=self.search_archive)
  16. t.start()
  17.  
  18. def search_archive(self):
  19. search_term = self.archiv_frame_search_entry.get()
  20. archive_list = self.ftp.get_archiv_list()
  21. if archive_list:
  22. self.archiv_frame_scrollable_button_frame.clear_items()
  23. for item in archive_list:
  24. if search_term.lower() in item.lower():
  25. self.archiv_frame_scrollable_button_frame.add_item(item)
Advertisement
Add Comment
Please, Sign In to add comment