Ctk ComboBox 出现故障

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

如您所见,我的文字超出了箭头,我该如何修复它? 这是我的代码:

class ComboBox(ctk.CTkComboBox):
    def __init__(self, master):
        super().__init__(master)
        self.configure(values=["Arduino Full Kit", "Arduino Basics Kit", "Arduino"],
                       #fg_color="#78BCC4",
                       text_color="#002C3E",
                       width=300,
                       height=50,
                       hover=True,
                       dropdown_hover_color='green',
                       variable=ctk.StringVar(value="Product...\n"),
                       state='readonly')

Text boundarie goes over the arrow

python user-interface tkinter customtkinter
1个回答
0
投票

简单的修复方法是将

self.configure(...)
中的选项移回
super().__init__()
:

class ComboBox(ctk.CTkComboBox):
    def __init__(self, master):
        super().__init__(master,
                         values=["Arduino Full Kit", "Arduino Basics Kit", "Arduino"],
                         #fg_color="#78BCC4",
                         text_color="#002C3E",
                         width=300,
                         height=50,
                         hover=True,
                         dropdown_hover_color='green',
                         variable=ctk.StringVar(value="Product...\n"),
                         state='readonly')

输出:

enter image description here

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