工具包应用程序中使用的customtkinter中的这个小部件名称是什么

问题描述 投票:0回答:1

我正在 CustomTkinter 中寻找小部件,但找不到它的名称以及如何操作,您可以使用我附加的图片来帮助我找到它的名称吗 小部件形状

python customtkinter
1个回答
0
投票

这里的可滚动框架中包含的小部件只是包含按钮和标签的框架。

您可以在

add_item
功能中看到他们的创作:

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)

如果您想使用这些小部件,我认为您不应该复制它们的代码并创建自己的代码,因为它可能没有针对您的项目进行优化。

希望我能帮到你,祝你有美好的一天。

© www.soinside.com 2019 - 2024. All rights reserved.