Last active
August 29, 2015 14:27
-
-
Save Alan-FGR/49a7fcaef57c62c9a03c to your computer and use it in GitHub Desktop.
kivy gridlayout problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.uix.gridlayout import GridLayout | |
from kivy.uix.label import Label | |
from kivy.uix.image import Image | |
from kivy.app import Builder, App | |
from random import randint | |
Builder.load_string(""" | |
<GridLayout>: | |
canvas: | |
Color: | |
rgba: 1,0,0,1 | |
Line: | |
rectangle: self.x+1,self.y+1,self.width-1,self.height-1 | |
<Image>: | |
canvas: | |
Color: | |
rgba: (0,1,0,0.3) | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
<Label>: | |
text_size: self.width, None | |
size_hint_y: None | |
height: self.texture_size[1] | |
""") | |
class ACListEntry(GridLayout): | |
def __init__(self, **kwargs): | |
super(ACListEntry, self).__init__(cols=2, size_hint_y=None, **kwargs) | |
self.bind(minimum_height = self.setter("height")) | |
img = Image(size_hint = (None,None), size = (60,60), source = "") | |
self.add_widget(img) | |
lbl = Label(text="TEST layout problem fds af dfsad fsd asdfs adfsad fdsf "*randint(1,6)) | |
self.add_widget(lbl) | |
class MyApp(App): | |
def build(self): | |
mainlayout = GridLayout(cols=1) | |
for _ in xrange(5): | |
mainlayout.add_widget(ACListEntry()) | |
return mainlayout | |
MyApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
workaround:
https://gist.github.com/Alan-FGR/c8e14994e7465398d5ed