Skip to content
Discussion options

You must be logged in to vote

Have a look at the following line again:

yield SystemCommand("Setting", "App Setting", self.switch_mode("setting"))

The third argument expects a callback, but you are calling switch_mode. So the switch happens right there in that method.

What you want is to supply a callable so the command palette can call it when it is selected. In the examples you linked to, you will notice that the third parameter is self.bell, and not self.bell().

Given that your callback has a parameter, you could replace the call with a partial or a lambda. Or define a new method. For example:

def switch_settings_mode(self):
    self.switch_mode("setting")
yield SystemCommand("Setting", "App Setting", self.switch_se…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cdxjcl
Comment options

Answer selected by cdxjcl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #6117 on September 11, 2025 15:40.