We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from kivy.lang import Builder from kivymd.app import MDApp from kivymd.uix.dialog import MDDialog from kivymd.uix.button import MDFlatButton
KV = ''' BoxLayout: orientation: 'vertical'
MDLabel: text: 'Quer namorar comigo?' halign: 'center' font_style: 'H4' size_hint_y: None height: self.texture_size[1] MDRaisedButton: text: 'Sim' size_hint: None, None width: 150 pos_hint: {'center_x': 0.5} on_release: app.dialog.open()
'''
class MyApp(MDApp): def build(self): self.dialog = MDDialog( title="Pedido de Namoro", text="Você aceita namorar comigo?", buttons=[ MDFlatButton( text="Sim", on_release=self.accept ), MDFlatButton( text="Não", on_release=self.dismiss ), ], ) return Builder.load_string(KV)
def accept(self, *args): self.dialog.dismiss() self.root.clear_widgets() self.root.add_widget( Builder.load_string( ''' MDLabel: text: 'Parabéns, agora somos namorados!' halign: 'center' font_style: 'H4' size_hint_y: None height: self.texture_size[1] ''' ) ) def dismiss(self, *args): self.dialog.dismiss() self.root.clear_widgets() self.root.add_widget( Builder.load_string( ''' MDLabel: text: 'Tudo bem, talvez da próxima vez.' halign: 'center' font_style: 'H4' size_hint_y: None height: self.texture_size[1] ''' ) )
if name == 'main': MyApp().run()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
KV = '''
BoxLayout:
orientation: 'vertical'
'''
class MyApp(MDApp):
def build(self):
self.dialog = MDDialog(
title="Pedido de Namoro",
text="Você aceita namorar comigo?",
buttons=[
MDFlatButton(
text="Sim", on_release=self.accept
),
MDFlatButton(
text="Não", on_release=self.dismiss
),
],
)
return Builder.load_string(KV)
if name == 'main':
MyApp().run()
The text was updated successfully, but these errors were encountered: