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.
python python-3.x kivy
add a comment |
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.
python python-3.x kivy
I suspect you should leave off the()
when setting yourinterface_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 thinkSettings
is the same asSettingsWithSidebar
. Look at the documenttion and choose a class from there that is identified as asettings widget
.
– John Anderson
2 days ago
add a comment |
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.
python python-3.x kivy
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
python python-3.x kivy
asked 2 days ago


SilverMonkey
646414
646414
I suspect you should leave off the()
when setting yourinterface_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 thinkSettings
is the same asSettingsWithSidebar
. Look at the documenttion and choose a class from there that is identified as asettings widget
.
– John Anderson
2 days ago
add a comment |
I suspect you should leave off the()
when setting yourinterface_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 thinkSettings
is the same asSettingsWithSidebar
. Look at the documenttion and choose a class from there that is identified as asettings 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
add a comment |
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)
.
add a comment |
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)
.
add a comment |
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)
.
add a comment |
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)
.
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)
.
answered 1 hour ago


SilverMonkey
646414
646414
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
I suspect you should leave off the
()
when setting yourinterface_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 asSettingsWithSidebar
. Look at the documenttion and choose a class from there that is identified as asettings widget
.– John Anderson
2 days ago