Skip to content
Advertisement

How to make Notes using kivyMD?

How to save Data in it? For Data saving in kivyMD which method should be used such as JSON or Python Dictionary? In additional, Can you tell me how to add reminder in calendar? Thnx A lot :)

Advertisement

Answer

class YourProgram(MDApp):
    def build_config(self, config):
        """Creates an application settings file yourapp.ini."""

        config.adddefaultsection("User")
        config.setdefault("User", "auth", "0")

    def build(self):
        self.set_value_from_config()

        [...]

    def set_value_from_config(self):
        """Sets the values of variables from the settings file
        yourapp.ini."""

        self.config.read(f"{self.user_data_dir}/yourapp.ini")
        self.user_auth = self.config.getint("User", "auth")

    def get_application_config(self):
        """Returns the path to the configuration file."""

        return super().get_application_config(
            "{}/%(appname)s.ini".format(self.user_data_dir)
        )

    def save_info_to_config(self):
        """Writes information about successful authorization to the settings file."""

        self.config.set("User", "auth", "1")
        self.config.write()
        self.set_value_from_config()
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement