Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # create archive frame & search bar
- self.archiv_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
- self.archiv_frame.rowconfigure(1, weight=1)
- self.archiv_frame.columnconfigure(0, weight=1)
- self.archiv_frame_scrollable_button_frame = ScrollableLabelButtonFrame(master=self.archiv_frame, width=300, corner_radius=0, command=self.archiv_button_reprint_event)
- self.archiv_frame_scrollable_button_frame.grid(row=1, column=0, columnspan=2, padx=20, pady=20, sticky="nsew")
- self.archiv_frame_search_entry = customtkinter.CTkEntry(self.archiv_frame)
- self.archiv_frame_search_entry.grid(row=0, column=0, padx=20, pady=[20, 0], sticky="ew")
- self.search_button = customtkinter.CTkButton(self.archiv_frame, text="Suchen", image=self.search_image, command=self.search_archive_thread)
- self.search_button.grid(row=0, column=1, padx=[0, 20], pady=[20, 0], sticky="e")
- def search_archive_thread(self):
- t = threading.Thread(target=self.search_archive)
- t.start()
- def search_archive(self):
- search_term = self.archiv_frame_search_entry.get()
- archive_list = self.ftp.get_archiv_list()
- if archive_list:
- self.archiv_frame_scrollable_button_frame.clear_items()
- for item in archive_list:
- if search_term.lower() in item.lower():
- self.archiv_frame_scrollable_button_frame.add_item(item)
Advertisement
Add Comment
Please, Sign In to add comment