Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.config import Config
- Config.set('graphics', 'width', '375')
- Config.set('graphics', 'height', '650')
- from kivymd.app import MDApp
- from kivy.lang import Builder
- from kivy.uix.widget import Widget
- from kivymd.uix.button import MDButton, MDButtonText
- from kivy.uix.screenmanager import ScreenManager, Screen
- from kivy.uix.boxlayout import BoxLayout
- from kivy.uix.textinput import TextInput
- from kivymd.uix.boxlayout import MDBoxLayout
- from kivymd.uix.dialog import (
- MDDialog,
- MDDialogIcon,
- MDDialogHeadlineText,
- MDDialogButtonContainer,
- MDDialogContentContainer,
- )
- from kivymd.uix.segmentedbutton import (
- MDSegmentedButton,
- MDSegmentedButtonItem,
- MDSegmentButtonLabel,
- )
- class MyBL1(BoxLayout):
- dialog = None
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- def challenge_friend(self): # Quizás pueda usar este diálogo para la 2nd pantalla
- if not self.dialog:
- self.dialog = MDDialog(
- MDDialogIcon(
- icon="sword-cross",
- pos_hint={'center_x': 0.5},
- ),
- MDDialogHeadlineText(
- text="Reto",
- ),
- MDDialogContentContainer(
- TextInput(
- hint_text="Usuario",
- multiline=False,
- pos_hint={'center_x': 0.5},
- size_hint_y=None,
- height="30dp",
- # border=(4, 4, 4, 4),
- background_color=(30, 23, 27, 0.2),
- ),
- MDBoxLayout(
- TextInput(
- hint_text="minutos",
- multiline=False,
- size_hint_y=None,
- height="30dp",
- # border=(4, 4, 4, 4),
- background_color=(30, 23, 27, 0.2),
- ),
- TextInput(
- hint_text="segundos",
- multiline=False,
- size_hint_y=None,
- height="30dp",
- # border=(4, 4, 4, 4),
- background_color=(30, 23, 27, 0.2),
- ),
- spacing="10dp",
- pos_hint={'center_x': 0.5},
- size_hint_y=None,
- height="30dp",
- ),
- MDSegmentedButton(
- MDSegmentedButtonItem(
- MDSegmentButtonLabel(
- text="Blancas",
- ),
- ),
- MDSegmentedButtonItem(
- MDSegmentButtonLabel(
- text="Negras",
- ),
- ),
- MDSegmentedButtonItem(
- MDSegmentButtonLabel(
- text="Aleatorio",
- ),
- ),
- type="small",
- ),
- MDSegmentedButton(
- MDSegmentedButtonItem(
- MDSegmentButtonLabel(
- text="Casual",
- ),
- ),
- MDSegmentedButtonItem(
- MDSegmentButtonLabel(
- text="Por puntos",
- ),
- ),
- type="small",
- ),
- orientation="vertical",
- spacing="10dp",
- ),
- MDDialogButtonContainer(
- Widget(),
- MDButton(
- MDButtonText(text="Cancel"),
- style="text",
- # on_release = self.stop_challenge,
- ),
- MDButton(
- MDButtonText(text="Aceptar"),
- style="text",
- # on_release = self.accept_challenge,
- ),
- ),
- )
- self.dialog.open()
- KV = """
- <MyBL1>
- Button:
- font_size: "30sp"
- text: "Create Dialog"
- on_release: root.challenge_friend()
- """
- Builder.load_string(KV)
- class MyApp(MDApp):
- def build(self):
- self.screenm = ScreenManager()
- self.mybl_uno = MyBL1()
- screen = Screen(name="first screen")
- screen.add_widget(self.mybl_uno)
- self.screenm.add_widget(screen)
- return self.screenm
- MyApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement