Reputation:
I recently updated my kvmd to version 0.104.1, it included some breaking changes for dialogs. My program contains a button which when pressed shows a dialog box containing some text and 2 buttons viz OK and CANCEL. The cancel button simply closes the dialog while the ok button changes the screen and has to close.
My problem is with the OK button, it changes the screen flawlessly but it doesn't close after that, even when I have added the dismiss()
but it works perfectly fine with Cancel button. So is there a problem in my code or is it a bug?
Code snippet:
def on_signup(self, *args):
self.dialog_close
self.sm.current = 'ninput'
def show_dialog(self, *args):
if not self.dialog:
self.dialog = MDDialog(title='Confirmation',
text='You have been registered.',
size_hint=(0.4, 0.3),
buttons=[
MDFlatButton(text='CANCEL',on_release=self.dialog_close),
MDFlatButton(text="OK!", on_release=self.on_signup)
])
self.dialog.open()
def dialog_close(self, *args):
self.dialog.dismiss(force=True)
Upvotes: 3
Views: 6408
Reputation: 1455
You forgot the brackets of your dialog_close() method, which is called in your on_signup() method. It should be like this:
def on_signup(self, *args):
self.dialog_close()
self.sm.current = 'ninput'
Upvotes: 2