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 showErrorView(self, isGetMsgDesc, msgCode, msgDesc=None): contentLayout = BoxLayout() contentLayout.orientation = "vertical" contentLayout.size_hint = (1, 1) if isGetMsgDesc == True: msgCodeDict = self.confDict.get(CONSTS.MSG_CODE_DICT) msgText = msgCodeDict.get(msgCode) if msgText == None: msgText = "Unknow error code->" + str(msgCode) else: msgText = str(msgCode) + "->" + msgText if msgDesc == None or msgDesc == "": contentLabel = SLabel(text=msgText, size_hint=(1, .8)) contentLabel.halign = "center" contentLayout.add_widget(contentLabel) else: titleLabel = SLabel(text=msgText, size_hint=(1, .2)) titleLabel.halign = "center" contentLayout.add_widget(titleLabel) slview = ScrollView(size_hint=(1, .6)) contentLayout.add_widget(slview) explainLayout = STableGridLayout(cols=1, spacing=1, size_hint_y=None) explainLayout.bind( minimum_height=explainLayout.setter('height')) for aStr in msgDesc: explainLabel = SLabel(text=aStr, size_hint=(1, None), height=20) explainLabel.halign = "center" explainLabel.color = colorHex("#000000") explainLabel.font_name = CONSTS.FONT_NAME explainLayout.add_widget(explainLabel) slview.add_widget(explainLayout) else: msgText = str(msgCode) + "->" + msgDesc contentLabel = SLabel(text=msgText, size_hint=(1, .8)) contentLabel.halign = "center" contentLayout.add_widget(contentLabel) sysConfDict = self.confDict.get(CONSTS.SYS_CONF_DICT) contentBtn = SButton(text=sysConfDict.get("MSG_CONFIRM"), size_hint=(1, .2)) contentLayout.add_widget(contentBtn) popup = Popup(title=sysConfDict.get("MSG_TITLE"), content=contentLayout, size_hint=(None, None), size=(200, 200), auto_dismiss=False) contentBtn.bind(on_press=popup.dismiss) popup.title_font = CONSTS.FONT_NAME 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 showErrMsg(self, errList): filePath = os.path.join( os.path.dirname(__file__), ".." + os.sep + "conf" + os.sep + "err_explain.ini") with open(filePath, 'r', encoding='utf-8-sig') as f: lineList = f.readlines() explainStr = "" for astr in lineList: explainStr += astr explainStr += "\n\n" for astr in errList: explainStr += astr + "\n" contentLayout = BoxLayout(size_hint=(1, 1), orientation="vertical") slview = ScrollView(size_hint=(1, .92)) contentLayout.add_widget(slview) explainLayout = BoxLayout(size_hint=(1, None)) explainLayout.bind(minimum_height=explainLayout.setter('height')) explainLabel = SLabel(text=explainStr, size_hint=(1, None)) explainLabel.halign = "center" explainLabel.font_name = CONSTS.FONT_NAME explainLayout.add_widget(explainLabel) slview.add_widget(explainLayout) bottomLayout = BoxLayout(size_hint=(1, .08)) closebtn_id = SButton(text="關閉", size_hint=(1, .8)) bottomLayout.add_widget(closebtn_id) contentLayout.add_widget(bottomLayout) popup = Popup(title="錯誤格式說明", content=contentLayout, size_hint=(None, None), size=(680, 400), auto_dismiss=False) closebtn_id.bind(on_press=popup.dismiss) popup.title_font = CONSTS.FONT_NAME popup.open()
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()