WindowController#

#

New in version 1.0.0.

Modules and classes that implement useful methods for getting information about the state of the current application window.

Controlling the resizing direction of the application window#

# When resizing the application window, the direction of change will be
# printed - 'left' or 'right'.

from kivymd.app import MDApp
from kivymd.uix.controllers import WindowController
from kivymd.uix.screen import MDScreen


class MyScreen(MDScreen, WindowController):
    def on_width(self, *args):
        print(self.get_window_width_resizing_direction())


class Test(MDApp):
    def build(self):
        return MyScreen()


Test().run()

API - kivymd.uix.controllers.windowcontroller#

class kivymd.uix.controllers.windowcontroller.WindowController#
on_size(instance, size: list) None#

Called when the application screen size changes.

get_real_device_type() str#

Returns the device type - ‘mobile’, ‘tablet’ or ‘desktop’.

get_window_width_resizing_direction() str#

Return window width resizing direction - ‘left’ or ‘right’.