这是否可以消除KivyMD中MDIconButton的涟漪效应

2024-04-25 00:42:54 发布

您现在位置:Python中文网/ 问答频道 /正文

这是否可能消除KivyMD中MDIconButton的涟漪效应

我正在尝试使用python KivyMD开发一个应用程序,为了获得更好的用户体验,我想消除MDIconButton的涟漪效应

main.py

from kivymd.app import MDApp
from kivy.uix.relativelayout import RelativeLayout



class MainWidget(RelativeLayout):
    pass

class TestApp(MDApp):
    def build(self):

        self.theme_cls.theme_style = "Dark"
        


if __name__ == '__main__':
    TestApp().run()


测试.kv

MainWidget:
    RelToolBar:

<RelToolBar@RelativeLayout>:
    size_hint: 1,.05
    pos_hint: {'x':0 , 'top':1 }
    canvas.before:
        Color:
            rgba: 0, 0, 0, .4
        Rectangle:
            size: self.size
    MDIconButton:
        halign: "center"
        icon: "menu"
        theme_text_color: "Primary"
        pos_hint: {'x':0 , 'center_y':.5 }
    MDLabel:
        text: "T E S T"
        theme_text_color: "Primary"
        halign: 'center'
        font_style: "Caption"


Tags: textfromimportselfsizemaintheme效应