mirror of https://github.com/kivy/kivy.git
fix passing default arguements
This commit is contained in:
parent
59008f4fba
commit
c459f74a1a
|
@ -23,8 +23,7 @@ class BubbleShowcase(FloatLayout):
|
||||||
self.add_widget(self.but_bubble)
|
self.add_widget(self.but_bubble)
|
||||||
|
|
||||||
def show_bubble(self, *l):
|
def show_bubble(self, *l):
|
||||||
bubb = Bubble(size_hint = (.27, .0792), arrow_pos = 'bottom_mid')
|
bubb = Bubble(size_hint = (.27, .0792), arrow_pos = 'bottom_right')
|
||||||
#bubb.content.rows = 1
|
|
||||||
bubb.content.cols = 3
|
bubb.content.cols = 3
|
||||||
bubb.add_widget(Button(text = 'Cut',
|
bubb.add_widget(Button(text = 'Cut',
|
||||||
background_normal = 'data/images/bubble_btn.png',
|
background_normal = 'data/images/bubble_btn.png',
|
||||||
|
|
|
@ -65,18 +65,18 @@ class Bubble(GridLayout):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.arrow_layout = GridLayout(rows = 1)
|
self.arrow_layout = GridLayout(rows = 1)
|
||||||
self.bk_img = Image(source = self.background_image,
|
self.bk_img = Image(source = self.background_image,
|
||||||
allow_stretch = True,
|
allow_stretch = True,
|
||||||
keep_ratio = False)
|
keep_ratio = False)
|
||||||
self.background_texture = self.bk_img.texture
|
self.background_texture = self.bk_img.texture
|
||||||
self.arrow_img = Image(source = self.arrow_image)
|
self.arrow_img = Image(source = self.arrow_image)
|
||||||
self.rows = 1
|
self.rows = 1
|
||||||
super(Bubble, self).__init__(**kwargs)
|
super(Bubble, self).__init__(**kwargs)
|
||||||
self.content = BubbleContent()
|
self.content = BubbleContent()
|
||||||
self.padding = 2
|
self.padding = 2
|
||||||
self.add_widget(self.content)
|
self.add_widget(self.content)
|
||||||
self.bk_img.bind(on_texture = self._on_texture)
|
self.bk_img.bind(on_texture = self._on_texture)
|
||||||
self.arrow_pos = 'bottom_mid'
|
self.on_arrow_pos()
|
||||||
|
|
||||||
def _on_texture(self, *l):
|
def _on_texture(self, *l):
|
||||||
self.background_texture = self.bk_img.texture
|
self.background_texture = self.bk_img.texture
|
||||||
|
@ -95,6 +95,9 @@ class Bubble(GridLayout):
|
||||||
self.arrow_img.source = self.arrow_image
|
self.arrow_img.source = self.arrow_image
|
||||||
|
|
||||||
def on_arrow_pos(self, *l):
|
def on_arrow_pos(self, *l):
|
||||||
|
if not self.content:
|
||||||
|
return
|
||||||
|
print self.content
|
||||||
self.arrow_layout.clear_widgets()
|
self.arrow_layout.clear_widgets()
|
||||||
self.clear_widgets()
|
self.clear_widgets()
|
||||||
self.arrow_img.size_hint = (1, None)
|
self.arrow_img.size_hint = (1, None)
|
||||||
|
|
Loading…
Reference in New Issue