如何在 kivy 或 kivymd 中正确使用 on_resize 函数

how to properly use on_resize function in kivy or kivymd

在我的应用程序中,我需要在调整大小时调用特定屏幕中的特定功能,它看起来像这样

class MainApp(MDApp):
    def on_resize(self):
        if self.manager.get_screen() == "table_screen":   
            if self.width>self.height:
                self.manager.get_screen("table_screen").ids.table_image.source="table1.png"
                self.manager.get_screen("table_screen").ids.left_panel.opacity=0
                print("PAPAPAPPAAPPA")
            else:
                self.ids.left_panel.size_hint_x=.5
                self.ids.left_panel.opacity=1
                print("PAPAPAPPAAPPA")

    def build(self):
        Window.bind(size=self.on_resize)
        return Main()

但是当我在任何屏幕上调整 window 大小时,图像破碎并且出现错误 on_resize() 采用 1 个位置参数,但给出了 3 个 这个错误的根源是什么?我看不到在任何地方给出 3 个参数

错误的根源是,当您将函数绑定到 属性 更改时,它接收到三个位置参数。它们是 self、属性 正在改变的 class 实例的实例,以及 属性.

的新值