Search code examples
pythonuser-interfacekivymd

KivyMD Hot Reload


KivyMD Hot Reload

May anybody explain every single thing to do a (hot reload) method in KivyMD? I have been watching a lot of videos, but nothing working for me. There's no specific error to solve it.


Solution

  • I had trouble getting it started too at first... I figured it out by watching kivymd's youtube videos at .25 speed lol...

    This works for me on my Mac

    1. Create a new pycharm project, set up a virtual environment, but don't install any packages yet

    2. Open the terminal within pycharm (make sure it says venv) and paste this command: (you can copy the whole thing and paste it in to run it all at once)

    git clone https://github.com/kivymd/KivyMD.git --depth 1
    cd KivyMD
    pip install .
    
    1. Still in the terminal, back out of the kivymd folder with cd ..

    2. Then get your current directory by running pwd and copy the output.

    3. Next thing you need to do is run this command in the terminal after you make a few changes:

    kivymd.create_project \
        MVC \
        /Users/macbookair/Projects \
        MyMVCProject \
        python3.10 \
        2.1.0 \
        --use_hotreload yes
    
    

    The line that says /Users/macbookair/Projects needs to be replaced with the output of your pwd terminal command. Be sure to not delete the \ at the end. You can also change the MyMVCProject to any name you want

    1. It will take a second for everything to install, but then you should see your project name folder in the project files. We need one more package to do the hotreload pip install watchdog

    2. Now to open our app in hotreload... first go into our project with cd mymvcproject and we need to run it in debug mode so run DEBUG=1 python main.py

    3. App should be run now in hot reload.

    Hope that helps