I want to align the text of the button to the left with halign='left'
in Kivy, but it does not work and keeps it centered.
This is my code:
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.properties import StringProperty
from kivy.properties import ObjectProperty
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 1
for i in range (0,10):
self.btn = Button(text=str(i),halign='left',background_color =(.3, .6, .7, 1))
self.btn.bind(on_press=self.pressed)
self.add_widget(self.btn)
def pressed(self, instance):
print ("Name:",instance.text)
class MyApp(App):
def build(self):
return MyGrid()
if __name__ == "__main__":
MyApp().run()