Ejemplo n.º 1
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.orientation = 'vertical'

        # simple label
        label1 = Label()
        label1.text = 'Hello Florian, \nWhat\'s up ?'
        label1.font_size = 42
        label1.bold = True
        label1.underline = True
        label1.halign = 'center'
        label1.color = (0, 1, 0, 1)
        self.add_widget(label1)

        # markup text
        label2 = Label()
        label2.text = '[size=30]I try to [u]code[/u] a [b]kivy app[/b] ![/size]'
        label2.halign = 'center'
        label2.markup = True
        label2.color = (0, 0, 1, 1)
        self.add_widget(label2)

        # unicode text
        label3 = Label()
        label3.text = 'هل يمكن تأجير عربات للأطفال؟'
        label3.font_name = 'DejaVuSans'
        self.add_widget(label3)

        # Icons text
        label4 = Label()
        label4.font_size = 60
        label4.text = '\uF00A'
        label4.font_name = 'Icons'
        self.add_widget(label4)
Ejemplo n.º 2
0
    def setLayout(self):
        self.size = (1500, 1000)

        with self.canvas:
            Color(.532345, 1.0, .742, 1.0)
            Rectangle(size=self.size)

        sound_board_layout = AnchorLayout()
        sound_board_layout.anchor_x = "center"
        sound_board_layout.anchor_y = "top"
        sound_board_layout.size = self.size
        sound_board_layout.pos = self.pos
        sound_board_layout.size_hint = (1.0, 1.0)
        sound_board_layout.spacing = 50

        self.title_layout.orientation = "vertical"
        self.title_layout.size_hint = (1.0, 1.0)
        self.title_layout.spacing = 10

        title_label = Label()
        title_label.text = "Soundboard"
        title_label.color = [.6, .2, 1, .5]
        title_label.font_size = 50
        title_label.font_name = "C:\\Windows\\Fonts\\Arial"
        title_label.size_hint = (1, 1)
        self.title_layout.add_widget(title_label)

        self.set_settings_layout()

        self.set_sounds()

        self.title_layout.add_widget(self.grid_layout)
        sound_board_layout.add_widget(self.title_layout)

        self.add_widget(sound_board_layout)
Ejemplo n.º 3
0
 def enterSubset(self, ctx):
     super(Listener, self).enterSubset(ctx)
     self.subsetstack.append(self.lastoperand)
     self.laystack.append(self.lastlay)
     vlay = BoxLayout()
     vlay.orientation = 'vertical'
     hlay = BoxLayout()
     hlay.orientation = 'horizontal'
     vlay.add_widget(hlay)
     hlay = BoxLayout()
     hlay.orientation = 'horizontal'
     vlay.add_widget(hlay)
     self.lastvlay = vlay
     self.lastlay.add_widget(vlay)
     self.lastlay = vlay.children[0]
     self.currentformat.push()
     self.currentformat.clearemphasise()
     self.currentformat.cleartype()
     if ctx.VARIABLE() or ctx.NUMBER():
         if ctx.VARIABLE():
             value = self.variablecontexttounicode(ctx.VARIABLE().getText())
             lbl = Label(text=value)
             lbl.font_name = self.currentformat.getfont()
             self.lastlay.add_widget(lbl)
         if ctx.NUMBER():
             self.lastlay.add_widget(Label(text=str(ctx.NUMBER().getText())))
     if self.debug:
         name = ''
         if ctx.VARIABLE():
             name += ctx.VARIABLE().getText() + ';'
         if ctx.NUMBER():
             name += ctx.NUMBER().getText()
         print 'Entered: subset: ' + name
Ejemplo n.º 4
0
 def get_label(self, text='', mono=False):
     label = Label(
         text=text, font_size=self.FONT_SIZE, halign="left", markup=True)
     if mono:
         label.font_name='DroidSansMono'
     label.bind(size=label.setter('text_size'))
     return label
Ejemplo n.º 5
0
    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()
Ejemplo n.º 6
0
 def AddKanji(self, kan):
     self.kanLayout.clear_widgets()
     label = Label(text=kan)
     label.font_name = "YuGothM.ttc"
     label.font_size = 115
     label.color = [0, 0, 0, 1]
     self.kanLayout.add_widget(label)
Ejemplo n.º 7
0
	def __init__(self,**kwargs):
		super(confirmExit,self).__init__(**kwargs)
		
		self.size_hint = (None, None)
		self.size = (290*g.scale, 290*g.scale)
		self.border = (0.2,0.4,0.2,0)
		
		self.auto_dismiss = False
		
		self.background_color = (0,0,0,0.2)
		self.background = g.IMG_CONFIRM_BG
		
		textlabel = Label(text = g.xml_root[6][5].text)
		textlabel.font_name = g.FONT_CR
		textlabel.font_size = 26*g.scale
		textlabel.color = g.COLOR_BLUE
		
		self.rl = RelativeLayout()
		self.add_widget(self.rl)
		
		self.rl.add_widget( confirmationButton('yes') )
		self.rl.add_widget( confirmationButton('no') )
		self.rl.add_widget( textlabel )
		
		# If we're in the main screen, add option to return to title
		if g.manager.current_screen.name == 'main_screen':
			self.title_btn = confSmallButton('title',self) #The btn will addd itself to parent
			show_undo = False
			if len(g.moves_history['player_1'])>0:
				show_undo = True
			if g.players == 1 and g.player == 'player_2':
				show_undo = False
			if show_undo:
				pass
			self.undo_btn = confSmallButton('undo',self) #The btn will addd itself to parent
		
		# Create volume button
		self.volume_btn = ToggleButton()
		self.volume_btn.size_hint = (None,None)
		self.volume_btn.size = (130*g.scale, 130*g.scale)
			
		self.volume_btn.border = (0,0,0,0)
		self.volume_btn.background_normal = g.IMG_CONFIRM_VOLUMEBTN_NORMAL
		self.volume_btn.background_down = g.IMG_CONFIRM_VOLUMEBTN_PRESS
		posx = self.size[0]/2 - self.volume_btn.size[0]/2
		posy = self.size[1]/2 - self.volume_btn.size[1]/2 + 235*g.scale
		self.volume_btn.pos = (posx, posy)
		self.volume_btn.bind( on_press = self.confirm_volume )
		
		if g.sound:
			self.volume_btn.state = 'normal'
		else:
			self.volume_btn.state = 'down'
			
		self.rl.add_widget(self.volume_btn)
Ejemplo n.º 8
0
def topleft_label(font_filepath=None, font_size='20sp'):
    l = Label(text="text",
              valign='top',
              font_size=font_size,
              pos=(Window.width * 0.5, Window.height * 0.4),
              text_size=(Window.width, Window.height))

    if font_filepath is not None:
        l.font_name = font_filepath

    return l
Ejemplo n.º 9
0
 def on_text(self, *_):
     """Scale the header text."""
     # Just get large texture:
     lbl = Label(text=self.text)
     lbl.font_size = '1000sp'
     lbl.font_name = 'Roboto-Bold'
     lbl.outline_width = 50
     lbl.padding_x = 250
     lbl.texture_update()
     # Set it to image, it'll be scaled to image size automatically:
     self.texture = lbl.texture
Ejemplo n.º 10
0
 def end_screen(self, *l):
     Clock.unschedule(self.show_time)
     Clock.unschedule(self.move)
     with self.canvas:
         label_end = Label(text='[i]Time of Survival: %s Seconds[/i]' %
                           (self.button.text),
                           markup=True,
                           pos=(Window.width / 2, Window.height / 3 * 2),
                           size=(0, 0))
         again_button = Button(pos=(Window.width / 2 - 80,
                                    Window.height / 3),
                               size=(160, 50))
     again_button.background_color = (0, 1, 1, 0.7)
     again_button.text += 'Play Again'
     # again_button.bind(on_press=again())
     label_end.font_size = 30
     label_end.font_name = 'Arial'
Ejemplo n.º 11
0
 def enterVariable(self, ctx):
     super(Listener, self).enterVariable(ctx)
     if not len(self.laystack):
         self.lastvlay = None
     if not self.lastlay:
         self.lastlay = BoxLayout()
         self.lastlay.orientation = 'horizontal'
     value = 0
     if ctx.VARIABLE():
         val = ctx.VARIABLE().getText()
         try:
             value = float(val)
         except:
             value = str(val)
     value = self.variablecontexttounicode(value)
     # self.lastoperand = Operand(val=value)
     lbl = Label(text=value)
     lbl.font_name = self.currentformat.getfont()
     self.lastlay.add_widget(lbl)
     if self.debug:
         name = 'not retrieved'
         if ctx.VARIABLE():
             name = ctx.VARIABLE().getText()
         print 'Entered: variable: ' + name
Ejemplo n.º 12
0
    def keyspop(self):
        box = BoxLayout(orientation="vertical")
        # box.add_widget(Image(source='images/appic.png', allow_stretch=False, keep_ratio=False, ))
        keysdata = "[color=f000ff]F11[/color]: \n" \
                   "[color=00ff00]Rotate the Window through 0, 90, 180 and 270 degrees[/color]\n\n" \
                   "[color=f000ff]Shift + F11[/color]: \n" \
                   "[color=00ff00]Switches between portrait and landscape on desktops[/color]\n\n" \
                   "[color=f000ff]F12[/color]: \n[color=00ff00]Take a screenshot[/color]\n\n"
        lb1 = Label(text=keysdata, markup=True)
        lb1.font_name = "fonts/DroidSans-Bold.ttf"
        lb1.bold = True
        box.add_widget(lb1)
        content2 = box
        self.popup = Popup(title="Special Keys",
                           content=content2,
                           size_hint=(None, None),
                           size=(500, 300))

        self.popup.background = "images/im2.png"
        self.popup.title_size = 30

        self.popup.title_color = [1, 1, 0, 1]
        self.popup.title_font = "fonts/actionis.ttf"
        self.popup.open()
 def build(self):
     #return Label(text=u"你好,世界!", font_name="msyh.ttf")
     a = Label()
     a.font_name = "msyh.ttf"
     a.text = u"你好,世界!"
     return a
Ejemplo n.º 14
0
 def build(self):
     a = Label()
     a.text = u"这里是中文哦"
     a.font_name = "/usr/share/cups/fonts/FreeMono.ttf"
     return a
Ejemplo n.º 15
0
    def build(self):
        Window.size = (300, 570)
        Window.clearcolor = (200, 200, 200, 1)

        label_events = Label()
        label_events.text = 'History of Events'
        label_events.size_hint = 1, 1.6
        label_events.color = 1, 0, 0, 1
        label_events.font_name = 'arial'
        label_events.font_size = 32
        sm.eventsScreen.add_widget(label_events)

        label_events = Label()
        label_events.text = student1.get_event()
        label_events.text = student1.get_second_event()
        label_events.text = student1.get_third_event()
        label_events.size_hint = 1, 1.3
        label_events.color = 1, 0, 0, 1
        label_events.font_name = 'arial'
        label_events.font_size = 25
        sm.eventsScreen.add_widget(label_events)

        label_events2 = Label()
        label_events2.text = student1.get_second_event()
        label_events2.size_hint = 1, 1
        label_events2.color = 1, 0, 0, 1
        label_events2.font_name = 'arial'
        label_events2.font_size = 25
        sm.eventsScreen.add_widget(label_events2)

        label_events3 = Label()
        label_events3.text = student1.get_third_event()
        label_events3.size_hint = 1, 0.7
        label_events3.color = 1, 0, 0, 1
        label_events3.font_name = 'arial'
        label_events3.font_size = 25
        sm.eventsScreen.add_widget(label_events3)

        label_app = Label()
        label_app.text = 'Rams Rewards App'
        label_app.size_hint = 1, 1
        label_app.color = 1, 0, 0, 1
        label_app.font_name = 'arial'
        label_app.font_size = 32
        sm.homeScreen.add_widget(label_app)

        label_0 = Label()
        label_0.text = 'Welcome ' + student1.get_name()
        label_0.size_hint = 1, 1.5
        label_0.color = 1, 0, 0, 1
        label_app.font_size = 32
        sm.homeScreen.add_widget(label_0)

        # Student Name
        label_1 = Label()
        label_1.text = 'Name: ' + student1.get_name()
        label_1.size_hint = 1, 1.5
        label_1.color = 1, 0, 0, 1
        sm.profileScreen.add_widget(label_1)

        # Student ID Label
        label_2 = Label()
        label_2.text = 'Student ID: ' + student1.get_student_id()
        label_2.size_hint = 1, 1.3
        label_2.color = 1, 0, 0, 1
        sm.profileScreen.add_widget(label_2)

        # Homeroom Label
        label_3 = Label()
        label_3.text = 'Homeroom: ' + student1.get_homeroom()
        label_3.size_hint = 1, 1.1
        label_3.color = 1, 0, 0, 1
        sm.profileScreen.add_widget(label_3)

        # Points Label
        label_4 = Label()
        label_4.text = 'Rewards Points: ' + str(student1.get_rewards_points())
        label_4.size_hint = 1, 0.9
        label_4.color = 1, 0, 0, 1
        sm.profileScreen.add_widget(label_4)

        return sm
Ejemplo n.º 16
0
    def __init__(self, paramDateText, **kwargs):
        super(SDatePicker, self).__init__(**kwargs)
        
        self.element_height = 28

        self.orientation = "vertical"

        self.date_text = paramDateText
        if paramDateText != None:
            self.date_text = paramDateText
        else:
            self.date_text = time.strftime(format('%Y%m%d'))
        self.yearInt = int(int(self.date_text) / 10000)
        self.monthInt = int(int(self.date_text) % 10000 / 100)
        self.dayInt = int(self.date_text) % 100

        yearMonthLayout = BoxLayout(size_hint=(1, None), orientation="horizontal", height=self.element_height)
        
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.11, 1))) #左邊間隙
        
        yearLeftBtn = SLRButton(text="<", size_hint=(.08, .8)) #年<
        yearLeftBtn.bind(on_press=self.yearLeftEvent)
        yearMonthLayout.add_widget(yearLeftBtn)
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.01, 1))) #間隔
        self.yearLabel = Label(text=str(self.yearInt), size_hint=(.2, 1)) #西元年的數字
        yearMonthLayout.add_widget(self.yearLabel)
        alabel = Label(text="年", size_hint=(.05, 1)) #年
        alabel.font_name = CONSTS.FONT_NAME
        yearMonthLayout.add_widget(alabel)
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.01, 1))) #間隔
        yearRightBtn = SLRButton(text=">", size_hint=(.08, .8)) #年>
        yearRightBtn.bind(on_press=self.yearRightEvent)
        yearMonthLayout.add_widget(yearRightBtn)
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.03, 1))) #年月之間隔
        monthLeftBtn = SLRButton(text="<", size_hint=(.08, .8)) #月<
        monthLeftBtn.bind(on_press=self.monthLeftEvent)
        yearMonthLayout.add_widget(monthLeftBtn)
        self.monthLabel = Label(text=str(self.monthInt), size_hint=(.1, 1)) #月的數字
        yearMonthLayout.add_widget(self.monthLabel)
        alabel = Label(text="月", size_hint=(.05, 1)) #月
        alabel.font_name = CONSTS.FONT_NAME
        yearMonthLayout.add_widget(alabel)
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.01, 1))) #間隔
        monthRightBtn = SLRButton(text=">", size_hint=(.08, .8)) #月>
        monthRightBtn.bind(on_press=self.monthRightEvent)
        yearMonthLayout.add_widget(monthRightBtn)
        yearMonthLayout.add_widget(BoxLayout(size_hint=(.11, 1))) #右邊間隙
        
        self.add_widget(yearMonthLayout)
        
        self.add_widget(BoxLayout(size_hint=(1, .01)))
        
        self.addWeekHead()
        
        self.add_widget(BoxLayout(size_hint=(1, .01)))
        
        self.selectDateDict = {}
        for i in range(1, 32):
            self.selectDateDict[i] = SDayButton(text=str(i), size_hint=(.14, None), height=self.element_height)
            self.selectDateDict[i].bind(on_release=self.dateSelectEvent)
        self.dateSelectEvent(self.selectDateDict[self.dayInt])
        
        slview = ScrollView()
        slview.size_hint = (1, .8)
        self.contentLayout = GridLayout(cols=7, spacing=2, size_hint_y=None)
        # Make sure the height is such that there is something to scroll.
        self.contentLayout.bind(minimum_height=self.contentLayout.setter('height'))

        self.addContent()

        slview.add_widget(self.contentLayout)
        
        self.add_widget(slview)
Ejemplo n.º 17
0
    def create_buttons(self, pressed):

        try:
            self.results.clear_widgets()

        except:
            print("Search list already empty")

        self.searchBar.text = self.searchBar.text.strip()
        if self.searchBar.text == "":
            return

        #converts Katakana to Hiragana (implies Romaji -> Hiragana) because
        #kataToHira converts katakana to romaji then converts to hiragana
        self.searchBar.text = convKana.romToHira(
            convKana, convKana.kataToRoma(convKana, self.searchBar.text))

        #prevent crash due to accessing non-pronouncable characters (converted text is empty (usually from inputting a non-syllable like "q"))
        if self.searchBar.text == "":
            return

        try:
            entryList = data[self.searchBar.text]
            if len(entryList) == 0:
                return
        except:
            return

        resGrid = GridLayout(cols=2,
                             rows=len(entryList),
                             padding=5,
                             spacing=5,
                             size_hint=(None, None),
                             width=500)
        resGrid.bind(minimum_height=resGrid.setter("height"))

        for x in entryList:
            if isinstance(x, Kanji):
                button = Button(text=x.getLiteral())
            elif isinstance(x, Word):
                try:
                    button = Button(text=x.getKanji()[0])
                except:  #displays only if only written in Hiragana/Katakana
                    button = Button(text=x.getReading()[0])

            button.size_hint = (None, None)
            button.size = (self.width * .9, self.height * .1)
            button.font_name = "YuGothM.ttc"
            button.bind(on_release=self.openEntry)
            button.obj = x
            resGrid.add_widget(button)

            if isinstance(x, Kanji):
                lab = Label(text="Kanji")
            elif isinstance(x, Word):
                lab = Label(text="Word")

            lab.size_hint = (None, None)
            lab.size = (self.width * .1, 40)
            lab.font_name = "CALLI___.TTF"
            lab.color = [0, 0, 0, 1]
            resGrid.add_widget(lab)

        self.results.add_widget(resGrid)
Ejemplo n.º 18
0
    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()