Skip to main content
 首页 » 编程设计

python之如何删除kivy中的弹出标题

2025年05月04日16tuyile006

我一直在想有没有办法去掉弹出窗口的标题栏:

由此

为此

提前致谢!

编辑:供将来使用的代码引用:

<MyPopup@Popup>: 
size_hint: None, None 
size: 300, 200 
title: 'Close' 
title_color: 0.7, 0, 0, 0.9 
separator_color: 0.4, 0.4, 0.4, 1 
title_align: 'center' 
BoxLayout: 
    orientation: 'vertical' 
    padding: 5, 5, 5, 5 
    cols: 2 
    Label: 
        color: 0.7, 0, 0, 0.9 
        center_x: root.center_x 
        center_y: root.center_y 
        text: 'Are you sure you want to exit?' 
    BoxLayout: 
        size_hint: 1, 0.6 
        Button: 
            color: 0.7, 0, 0, 0.9 
            background_color: 0.4, 0.4, 0.4, 0.05 
            text: 'Yes' 
            on_release: exit() 
        Button: 
            color: 0.7, 0, 0, 0.9 
            background_color: 0.4, 0.4, 0.4, 0.05 
            text: 'No' 
            on_release: root.dismiss() 

请您参考如下方法:

改用 ModalView。这是弹出式行为的基类,Popup 是一个添加了标题的 ModalView。