Reputation: 19
class Template_Screen (Screen):
pass
Above is the class which i have added into a App class as follows
class MAKE_HTML(App):
"""
Still i need to write it fully.... Thanks for patience.....
"""
def build(self):
sm = ScreenManager()
sm.add_widget(Template_Screen(name='Select Template'))
I am using the kv file which is as follows
#the below screen gives the template
<Template_Screen>
ScrollView:
do_scroll_y:True
do_scroll_x: False
GridLayout:
size_hint_y:None
cols:1
height:self.minimum_height
BoxLayout:
Image:
source: "Images/Templates Pictures/Temp-1.png"
Label:
text:"Some sort of text\n Some text"
Problems:
I want to scroll with above like o/p.
Upvotes: 0
Views: 79
Reputation: 38822
The default value for effect_cls
of a ScrollView
is DampedScrollEffect
, which the documentation describes as:
DampedScrollEffect: The current default. Allows the user to scroll beyond the normal boundaries, but has the content spring back once the touch/click is released.
So that is the automatic scrolling effect that you see. You can eliminate that behavior by using ScrollEffect
as the effect_cls
, but that will also prevent you from scrolling when the contents do not fill the ScrollView
When you use height:self.minimum_height
for a GridLayout
, you must provide a height
for each child. Since you want the Image
to be half the size of the Screen
, you can use a kv
like this:
#the below screen gives the template
<Template_Screen>
ScrollView:
do_scroll_y:True
do_scroll_x: False
effect_cls: 'ScrollEffect'
GridLayout:
size_hint_y:None
cols:1
height:self.minimum_height
BoxLayout:
size_hint: None, None
size: root.width/2, root.height/2
Image:
source: "mages/Templates Pictures/Temp-1.png"
allow_stretch: True
keep_ratio: True
Label:
text:"Some sort of text\\n Some text"
size_hint: None, None
size: self.texture_size
Upvotes: 1