Search code examples
pythonuser-interfacecustomtkinter

What is the name of this widget used in customtkinter


I am looking for a specific widget in CustomTkinter. However, I'm unable to find it's name and how to use it to make GUI. Please help me identify this widgets

enter image description here


Solution

  • The widgets contained in the scrollable frame here are just frame that contain a button and a label.

    You can see their creation in the add_item function:

    def add_item(self, name, icon):
            """ add new package to the list """
            self.item_frame[name] = customtkinter.CTkFrame(self.scrollable_frame)
            self.item_frame[name].pack(expand=True, fill="x", padx=5, pady=5)
    
            if icon == "tk":
                icon = self.tkimage
            elif icon == "ctk":
                icon = self.ctkimage
            elif icon == "pkg":
                icon = self.packageimage
            else:
                icon = None
    
            self.item_frame[name].columnconfigure(0, weight=1)
            item_name = customtkinter.CTkButton(self.item_frame[name], fg_color="transparent", image=icon,
                                                text_color=customtkinter.ThemeManager.theme["CTkLabel"]["text_color"],
                                                height=50, anchor="w", font=(self.font, 15, "bold"), width=500,
                                                text=name, hover=False,
                                                command=lambda: threading.Thread(target=self.open_info_window, args=(name,),
                                                                                 daemon=True).start())
            item_name.grid(row=0, column=0, sticky="ew", pady=5, padx=5)
    
            if self.data[name]["name"] in self.modules:
                version = pkg_resources.get_distribution(self.data[name]["name"]).version
                desc = f"{self.data[name]['desc']} \nversion: {version}"
                self.data[name]["installation"] = f"{self.data[name]['installation']} --upgrade"
            else:
                self.item_frame[name].configure(fg_color="grey20")
                desc = f"{self.data[name]['desc']} "
    
            item_label = customtkinter.CTkLabel(self.item_frame[name], width=250, justify="left", text=desc, anchor="w",
                                                wraplength=250)
            item_label.grid(row=0, column=1, padx=5)
    

    If you want to use these widgets, I think you should not copy their code and just create your own because it might not be optimised for your project.

    Hope I helped you, have a nice day.