How to change the settings type and position of a kivy app?











up vote
0
down vote

favorite












I not able to find out how to change the type of the displayed settings panel used in my kivy app. I currently use following code to create the panel:



def build_config(self, config):
config.read("settings.ini")
App.build_config(self, config)

def build_settings(self, settings):
settings.size_hint = (0.8, 0.8)
settings.pos = (200,200)
settings.interface_cls = SettingsWithSidebar()
settings.add_json_panel("General Settings", self.config,
filename="settings_general.json")
settings.add_json_panel("Analysis", self.config,
filename="settings_analysis.json")
App.build_settings(self, settings)


That gives me the standard SettingsWithSidebar panel, which looks relatively ugly. I want to change that to standard Settings panel, which looks imo much nicer, but cannot find out how to do it.
I looked at the docs and found the interface_cls property, but changing its value to Settings() or SettingsWithSidebar() seems to do nothing.



My second problem is that i do not know how to set the position of the settings panel according to the position of the app (the 200,200 are a placeholder). I know how that can be accomplished in kv-language, but i do not know how i can reference the pos of the app before it is created. I do want to bind the center of the settings panel to the center of the application window, but i cannot find sources on how to accomplish that task.










share|improve this question






















  • I suspect you should leave off the () when setting your interface_cls.
    – John Anderson
    2 days ago










  • You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
    – SilverMonkey
    2 days ago










  • Yes, that is what I mean.
    – John Anderson
    2 days ago






  • 1




    Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
    – John Anderson
    2 days ago

















up vote
0
down vote

favorite












I not able to find out how to change the type of the displayed settings panel used in my kivy app. I currently use following code to create the panel:



def build_config(self, config):
config.read("settings.ini")
App.build_config(self, config)

def build_settings(self, settings):
settings.size_hint = (0.8, 0.8)
settings.pos = (200,200)
settings.interface_cls = SettingsWithSidebar()
settings.add_json_panel("General Settings", self.config,
filename="settings_general.json")
settings.add_json_panel("Analysis", self.config,
filename="settings_analysis.json")
App.build_settings(self, settings)


That gives me the standard SettingsWithSidebar panel, which looks relatively ugly. I want to change that to standard Settings panel, which looks imo much nicer, but cannot find out how to do it.
I looked at the docs and found the interface_cls property, but changing its value to Settings() or SettingsWithSidebar() seems to do nothing.



My second problem is that i do not know how to set the position of the settings panel according to the position of the app (the 200,200 are a placeholder). I know how that can be accomplished in kv-language, but i do not know how i can reference the pos of the app before it is created. I do want to bind the center of the settings panel to the center of the application window, but i cannot find sources on how to accomplish that task.










share|improve this question






















  • I suspect you should leave off the () when setting your interface_cls.
    – John Anderson
    2 days ago










  • You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
    – SilverMonkey
    2 days ago










  • Yes, that is what I mean.
    – John Anderson
    2 days ago






  • 1




    Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
    – John Anderson
    2 days ago















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I not able to find out how to change the type of the displayed settings panel used in my kivy app. I currently use following code to create the panel:



def build_config(self, config):
config.read("settings.ini")
App.build_config(self, config)

def build_settings(self, settings):
settings.size_hint = (0.8, 0.8)
settings.pos = (200,200)
settings.interface_cls = SettingsWithSidebar()
settings.add_json_panel("General Settings", self.config,
filename="settings_general.json")
settings.add_json_panel("Analysis", self.config,
filename="settings_analysis.json")
App.build_settings(self, settings)


That gives me the standard SettingsWithSidebar panel, which looks relatively ugly. I want to change that to standard Settings panel, which looks imo much nicer, but cannot find out how to do it.
I looked at the docs and found the interface_cls property, but changing its value to Settings() or SettingsWithSidebar() seems to do nothing.



My second problem is that i do not know how to set the position of the settings panel according to the position of the app (the 200,200 are a placeholder). I know how that can be accomplished in kv-language, but i do not know how i can reference the pos of the app before it is created. I do want to bind the center of the settings panel to the center of the application window, but i cannot find sources on how to accomplish that task.










share|improve this question













I not able to find out how to change the type of the displayed settings panel used in my kivy app. I currently use following code to create the panel:



def build_config(self, config):
config.read("settings.ini")
App.build_config(self, config)

def build_settings(self, settings):
settings.size_hint = (0.8, 0.8)
settings.pos = (200,200)
settings.interface_cls = SettingsWithSidebar()
settings.add_json_panel("General Settings", self.config,
filename="settings_general.json")
settings.add_json_panel("Analysis", self.config,
filename="settings_analysis.json")
App.build_settings(self, settings)


That gives me the standard SettingsWithSidebar panel, which looks relatively ugly. I want to change that to standard Settings panel, which looks imo much nicer, but cannot find out how to do it.
I looked at the docs and found the interface_cls property, but changing its value to Settings() or SettingsWithSidebar() seems to do nothing.



My second problem is that i do not know how to set the position of the settings panel according to the position of the app (the 200,200 are a placeholder). I know how that can be accomplished in kv-language, but i do not know how i can reference the pos of the app before it is created. I do want to bind the center of the settings panel to the center of the application window, but i cannot find sources on how to accomplish that task.







python python-3.x kivy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









SilverMonkey

646414




646414












  • I suspect you should leave off the () when setting your interface_cls.
    – John Anderson
    2 days ago










  • You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
    – SilverMonkey
    2 days ago










  • Yes, that is what I mean.
    – John Anderson
    2 days ago






  • 1




    Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
    – John Anderson
    2 days ago




















  • I suspect you should leave off the () when setting your interface_cls.
    – John Anderson
    2 days ago










  • You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
    – SilverMonkey
    2 days ago










  • Yes, that is what I mean.
    – John Anderson
    2 days ago






  • 1




    Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
    – John Anderson
    2 days ago


















I suspect you should leave off the () when setting your interface_cls.
– John Anderson
2 days ago




I suspect you should leave off the () when setting your interface_cls.
– John Anderson
2 days ago












You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
– SilverMonkey
2 days ago




You mean i should simply set it to "Settings" instead of "Settings()"? I also tried that but it also did not work.
– SilverMonkey
2 days ago












Yes, that is what I mean.
– John Anderson
2 days ago




Yes, that is what I mean.
– John Anderson
2 days ago




1




1




Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
– John Anderson
2 days ago






Actually, I think Settings is the same as SettingsWithSidebar. Look at the documenttion and choose a class from there that is identified as a settings widget .
– John Anderson
2 days ago














1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Okay, i found the solution to my problem:
To use any other Settings panel than the standard one, one has to change the settings_cls property of the App class, not of the Settings itself. This can be done by adding



self.settings_cls = Settings # Desired settings class


to the build method of the app.



To change the position of the Settings popup, one has to change the pos_hint of Settings object given to the build_settings method of the app class. Example: To change the size of the settings window to 90% of the app size and then position it in the center of the app, one has to add:



settings.pos_hint = ({"center_x": .5, "center_y": .5})
settings.size_hint = (0.9, 0.9)


to the build_settings method (where settings is the settings object passed to the method) before calling App.build_settings(self, settings).






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373049%2fhow-to-change-the-settings-type-and-position-of-a-kivy-app%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    Okay, i found the solution to my problem:
    To use any other Settings panel than the standard one, one has to change the settings_cls property of the App class, not of the Settings itself. This can be done by adding



    self.settings_cls = Settings # Desired settings class


    to the build method of the app.



    To change the position of the Settings popup, one has to change the pos_hint of Settings object given to the build_settings method of the app class. Example: To change the size of the settings window to 90% of the app size and then position it in the center of the app, one has to add:



    settings.pos_hint = ({"center_x": .5, "center_y": .5})
    settings.size_hint = (0.9, 0.9)


    to the build_settings method (where settings is the settings object passed to the method) before calling App.build_settings(self, settings).






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      Okay, i found the solution to my problem:
      To use any other Settings panel than the standard one, one has to change the settings_cls property of the App class, not of the Settings itself. This can be done by adding



      self.settings_cls = Settings # Desired settings class


      to the build method of the app.



      To change the position of the Settings popup, one has to change the pos_hint of Settings object given to the build_settings method of the app class. Example: To change the size of the settings window to 90% of the app size and then position it in the center of the app, one has to add:



      settings.pos_hint = ({"center_x": .5, "center_y": .5})
      settings.size_hint = (0.9, 0.9)


      to the build_settings method (where settings is the settings object passed to the method) before calling App.build_settings(self, settings).






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        Okay, i found the solution to my problem:
        To use any other Settings panel than the standard one, one has to change the settings_cls property of the App class, not of the Settings itself. This can be done by adding



        self.settings_cls = Settings # Desired settings class


        to the build method of the app.



        To change the position of the Settings popup, one has to change the pos_hint of Settings object given to the build_settings method of the app class. Example: To change the size of the settings window to 90% of the app size and then position it in the center of the app, one has to add:



        settings.pos_hint = ({"center_x": .5, "center_y": .5})
        settings.size_hint = (0.9, 0.9)


        to the build_settings method (where settings is the settings object passed to the method) before calling App.build_settings(self, settings).






        share|improve this answer












        Okay, i found the solution to my problem:
        To use any other Settings panel than the standard one, one has to change the settings_cls property of the App class, not of the Settings itself. This can be done by adding



        self.settings_cls = Settings # Desired settings class


        to the build method of the app.



        To change the position of the Settings popup, one has to change the pos_hint of Settings object given to the build_settings method of the app class. Example: To change the size of the settings window to 90% of the app size and then position it in the center of the app, one has to add:



        settings.pos_hint = ({"center_x": .5, "center_y": .5})
        settings.size_hint = (0.9, 0.9)


        to the build_settings method (where settings is the settings object passed to the method) before calling App.build_settings(self, settings).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        SilverMonkey

        646414




        646414






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373049%2fhow-to-change-the-settings-type-and-position-of-a-kivy-app%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter