mirror of https://github.com/kivy/kivy.git
Update bubble.py
This version sets the arrow image size independent of the device screen. This is good for high dpi screens, where the arrow is very small using the standard bubble.py.
This commit is contained in:
parent
acaad9b0dd
commit
0e1f100a8d
|
@ -69,6 +69,7 @@ from kivy.properties import ObjectProperty, StringProperty, OptionProperty, \
|
||||||
ListProperty, BooleanProperty
|
ListProperty, BooleanProperty
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.base import EventLoop
|
from kivy.base import EventLoop
|
||||||
|
from kivy.metrics import dp
|
||||||
|
|
||||||
|
|
||||||
class BubbleButton(Button):
|
class BubbleButton(Button):
|
||||||
|
@ -179,6 +180,7 @@ class Bubble(GridLayout):
|
||||||
keep_ratio=False, color=self.background_color)
|
keep_ratio=False, color=self.background_color)
|
||||||
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,
|
||||||
|
allow_stretch=True,
|
||||||
color=self.background_color)
|
color=self.background_color)
|
||||||
self.content = content = BubbleContent(parent=self)
|
self.content = content = BubbleContent(parent=self)
|
||||||
super(Bubble, self).__init__(**kwargs)
|
super(Bubble, self).__init__(**kwargs)
|
||||||
|
@ -278,7 +280,7 @@ class Bubble(GridLayout):
|
||||||
self_content.parent = None
|
self_content.parent = None
|
||||||
|
|
||||||
self_arrow_img.size_hint = (1, None)
|
self_arrow_img.size_hint = (1, None)
|
||||||
self_arrow_img.height = self_arrow_img.texture_size[1]
|
self_arrow_img.height = dp(10)
|
||||||
self_arrow_img.pos = 0, 0
|
self_arrow_img.pos = 0, 0
|
||||||
widget_list = []
|
widget_list = []
|
||||||
arrow_list = []
|
arrow_list = []
|
||||||
|
|
Loading…
Reference in New Issue