from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
import fontawesome
Builder.load_string("""
<Root>:
BoxLayout:
ButtonIcon:
icon: "fontawesome.icons['thumbs-up']"
ltext: "Text left"
rtext: "Text right"
text: root.iconText(self.icon, self.ltext, self.rtext)
font_size: 25
padding: 0.5, 0
<ButtonIcon@Button>:
markup: True
ltext: ""
rtext: ""
""")
class Root(BoxLayout):
def iconText(self, icon, ltext='', rtext=''):
Ltext = ''
if (ltext != ''):
Ltext = "[font=Roboto]" + ltext + "[/font] "
Rtext = ''
if (rtext != ''):
Rtext = " [font=Roboto]" + rtext + "[/font]"
fontIcon = "[font=fonts/fontawesome-webfont.ttf]" + eval(icon) + "[/font]"
text = Ltext + fontIcon + Rtext
return text
class MyApp(App):
def build(self):
return Root()
if __name__ == "__main__":
MyApp().run()
words_list = ['Ooh,','the','reason','I','hold','on',
'Ooh,','cause','I','need','this','hole','gone',
'Well,','funny',"you're",'the','broken','one']
words_with_commas_list = []
for i in words_list:
for j in i:
if j == ",":
words_with_commas_list.append(i)
print(words_with_commas_list)
words_list = ['Ooh,','the','reason','I','hold','on',
'Ooh,','cause','I','need','this','hole','gone',
'Well,','funny',"you're",'the','broken','one']
words_with_commas_list = []
for i in words_list:
if not i.isalnum() and ',' in i:
words_with_commas_list.append(i)
print(words_with_commas_list)
words_list = ['Ooh,','the','reason','I','hold','on',
'Ooh,','cause','I','need','this','hole','gone',
'Well,','funny',"you're",'the','broken','one']
words_with_commas_list = []
for i in words_list:
if i.endswith(','):
words_with_commas_list.append(i)
print(words_with_commas_list)