Reputation: 229
In a .kv file, I have
<P>:
ScrollView:
Label:
size_hint_y: None
text_size: (self.width, None)
id: table
height: self.texture_size[1]
and in the corresponding .py file, I have
class P(FloatLayout):
def __init__(self, data1, data2, **kwargs):
super().__init__(**kwargs)
self.ids.table.text = str(data1[0] + data2[0])
def show_popup(data1, data2):
show = P(data1, data2)
popupWindow = Popup(title='Settings Window', content=show, size_hint=(None, None), size=(400, 400))
popupWindow.open()
However, the result is this:
How can I get the text to fall inside the popup window? If possible, I'd like to make the popup window much larger, and have a scrollable text in the window. I have tried messing around with size_hint
and pos_hint
as attirbutes of <P>
to make the popup window bigger, and as attributes of ScrollView
to move the text into the box, but this doesn't seem to be having any effect. (I used values between 0 and 1)
Upvotes: 0
Views: 448
Reputation: 38857
The FloatLayout
does not position its children, you must do that. So there are three ways to correct your P
class:
pos_hint
to position the ScrollView
, probably like pos_hint: {'center_x': 0.5, 'center_y': 0.5}
.Or,
P
from FloatLayout
to RelativeLayout
.Or,
ScrollView
, like pos: root.pos
.Upvotes: 1