def author(self): box = BoxLayout(orientation="vertical") box.add_widget( Image( source='images/author.jpg', allow_stretch=False, keep_ratio=False, )) data = "Author :[color=ffff00]Ahmed Mohmed[/color]\nVersion :[color=ffff00]1.0[/color]" lb2 = Label(text=data, markup=True, font_size=30) lb2.font_name = "fonts/DancingScript-Bold.ttf" box.add_widget(lb2) content3 = box title = "About Tic Tac Toc" popup = Popup(title="About Tic Tac Toc", content=content3, size_hint=(None, None), size=(400, 400)) # popup.background_color=[0,1,1,1] popup.background = "images/au.jpg" popup.title_size = 30 popup.title_color = [1, 1, 0, 1] popup.title_font = "fonts/actionis.ttf" popup.open()
def control(self): box = BoxLayout(orientation="vertical") box.add_widget( Image( source='images/gamepad.jpg', allow_stretch=False, keep_ratio=False, )) content3 = box popup = Popup(title="Controlling", content=content3, size_hint=(None, None), size=(500, 500)) # popup.background_color=[0,1,1,1] popup.background = "images/au.jpg" popup.title_size = 30 popup.title_color = [1, 1, 0, 1] popup.title_font = "fonts/actionis.ttf" popup.open()
def _return_popup( self, title: AnyStr, content: Widget, size: Tuple = (500, 100), size_hint=(None, None) ) -> Popup: """ This method is for creating a unified Popup which will have a similar design throughout the application :param title: Title of the popup :type title: str :param content: content to be put in the popup :type content: Widget :param size: size of the Popup :type size: tuple :param size_hint: size hint of the Popup wrt to the parent :type size_hint: tuple; default=(500, 100) :return: the generated Popup :rtype: Popup """ popup = Popup(title=f"{self.constants.name} - {title}", content=content, size=size, size_hint=size_hint, title_align='center') # popup_background = ModalView() # popup_background.add_widget(Image(source=self.constants.rocket_image)) # popup.background = self.constants.rocket_image popup.background_color = [0, 255, 220, 0.9] popup.title_size = 18 # size in sp 255 0 120 popup.title_color = [1, 255, 0, 1] # rgba (pink) popup.separator_color = [1, 0, 255, 255] # rgba (cyan) popup.separator_height = 5 return popup
def winner(self, obj): pdata = "" title = "" sound = SoundLoader.load("sound/Sax.ogg") box = BoxLayout(orientation="vertical") box.add_widget( Image( source='images/gamepad3.png', allow_stretch=False, keep_ratio=False, )) if lista == standx or listb == standx or listc == standx or listd == standx or liste == standx or listf == standx or listg == standx or listh == standx: pdata = "[color=00ff00]Game over[/color]: [color=0000ff] player 1 win[/color]" title = "Congratulations player1" lb1 = Label(text=pdata, markup=True, font_size=25) lb1.font_name = "fonts/DroidSans-Bold.ttf" lb1.bold = True butt1 = Button(text="Play Again") box.add_widget(lb1) box.add_widget(butt1) content2 = box popup = Popup(title=title, content=content2, size_hint=(None, None), size=(400, 400)) popup.background = "images/au.jpg" popup.title_size = 30 popup.title_color = [1, 1, 0, 1] popup.title_font = "fonts/actionis.ttf" butt1.background_color = [1, 1, 0, 1] butt1.bind(on_release=self.reset) butt1.bind(on_release=popup.dismiss) popup.open() anim = Animation(x=50) + Animation(size=(300, 300), duration=2.) anim.start(popup) sound.play() Clock.unschedule(self.winner, .1) lista.clear(), listb.clear(), listc.clear(), listd.clear( ), liste.clear(), listf.clear(), listg.clear(), listh.clear() elif lista == stando or listb == stando or listc == stando or listd == stando or liste == stando or listf == stando or listg == stando or listh == stando: pdata = "[color=00ff00]Game over[/color]:[color=ff0000] player 2 win[/color]" title = "Congratulations player2" lb1 = Label(text=pdata, markup=True, font_size=25) lb1.font_name = "fonts/DroidSans-Bold.ttf" lb1.bold = True butt1 = Button(text="Play Again") box.add_widget(lb1) box.add_widget(butt1) content2 = box popup = Popup(title=title, content=content2, size_hint=(None, None), size=(400, 400)) popup.background = "images/au.jpg" popup.title_size = 30 popup.title_color = [1, 1, 0, 1] popup.title_font = "fonts/actionis.ttf" butt1.background_color = [1, 1, 0, 1] butt1.bind(on_release=self.reset) butt1.bind(on_release=popup.dismiss) popup.open() anim = Animation(x=50) + Animation(size=(300, 300), duration=2.) anim.start(popup) sound.play() lista.clear(), listb.clear(), listc.clear(), listd.clear( ), liste.clear(), listf.clear(), listg.clear(), listh.clear() elif self.ids.click1.disabled == True and self.ids.click2.disabled == True and self.ids.click3.disabled == True and self.ids.click4.disabled == True and self.ids.click5.disabled == True and self.ids.click6.disabled == True and self.ids.click7.disabled == True and self.ids.click8.disabled == True and self.ids.click9.disabled == True: pdata = "[color=00ff00]Game over[/color]: [color=f0ff00] Drwa [/color]" title = "No Winner" lb1 = Label(text=pdata, markup=True, font_size=25) lb1.font_name = "fonts/DroidSans-Bold.ttf" lb1.bold = True butt1 = Button(text="Play Again") box.add_widget(lb1) box.add_widget(butt1) content2 = box popup = Popup(title=title, content=content2, size_hint=(None, None), size=(400, 400)) popup.background = "images/au.jpg" popup.title_size = 30 popup.title_color = [1, 1, 0, 1] popup.title_font = "fonts/actionis.ttf" butt1.background_color = [1, 1, 0, 1] butt1.bind(on_release=self.reset) butt1.bind(on_release=popup.dismiss) popup.open() anim = Animation(x=50) + Animation(size=(300, 300), duration=2.) anim.start(popup) sound.play() lista.clear(), listb.clear(), listc.clear(), listd.clear( ), liste.clear(), listf.clear(), listg.clear(), listh.clear()