KivyMD
KivyMD copied to clipboard
Hot reload for python files
Description of the Bug
Hot reload is not working on other python files. It watches main.py
by default ig.
But with home_page.py
file which is imported in main.py
is not working properly.
But If I make changes... terminal gets updated but not reflecting in window.
And I'm using Python Declarative style instead .kv
Code and Logs
# `main.py`
from kivy import Config
# config window size
Config.set("graphics", "width", 360)
Config.set("graphics", "height", 640)
from libs.screens.home_page import HomePage
from kivymd.tools.hotreload.app import MDApp
class MainApp(MDApp):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def build_app(self):
return HomePage()
if __name__ == "__main__":
MainApp().run()
# `home_page.py`
from kivy.utils import get_color_from_hex
from kivymd.uix.screen import MDScreen
from kivymd.uix.relativelayout import MDRelativeLayout
class HomePage(MDScreen):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.md_bg_color = get_color_from_hex("#03020c")
self.add_widget(self.app_bar())
# AppBar layout
def app_bar(self) -> MDRelativeLayout:
# Appbar elements
app_bar_layout = MDRelativeLayout(
size_hint_y=0.1,
pos_hint={"top": 1},
)
# ...rest codes
return app_bar_layout
Versions
- OS: Linux
- Python: 3.10.10
- Kivy: 2.2.1
- KivyMD: 1.1.1
Hot reload is not working well yet. We will work on improving it in version 1.3.0
Hi, Will support for kv
file be added too?
How ever the hot reload for .kv files works properly in windows/linux You can refer for more info: https://github.com/ramayanbindas/Kivymd_hotreload_demo It not works for .py files.