Merhabalar,
Kivy uzerinde 100 lerce resmi guzel bir sekilde gostermeye calisiyordum.Ama resimlerin bir kismini gosterebiliyor,bir kismi ise pencerenin otesinde gozukmuyor.Cok arastirdim,kivy modullerine bakmaktan canim cikti😁,ama ne yazik ki istedigimi bulamadim.Ne yapmaliyim bunun icin?(biliyorum pek aciklayamadim durumu.Ama uygun bir anda sorunumu anlayabilmeniz icin fotoğraf koyarim.Ama yine de yardimci olabilirseniz memnun olurum.)
Belki ScrollView kullanilabilir ama deneyemedim ki!Bilemiyorum.Akilli tahtada da deneme sansim yok maalesef(haftasonu tatili,yoksa kivy tıkır tıkır
calisiyor.) .O yuzden fotoğraf atamiyorum ki.
Yani elimde soyle bir kod var.
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.loader import Loader
from kivy.uix.image import AsyncImage
from kivy.uix.button import Button
from kivy.lang import Builder
kv = """
BoxLayout:
orientation: "vertical"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg"
RelativeLayout:
AsyncImage:
source: "http://wallpaper-gallery.net/images/wallpapers-for-android-mobile/wallpapers-for-android-mobile-0.jpg"
"""
class yukleme(RelativeLayout):
pass
class foto(App):
def build(self):
#düzen = BoxLayout(orientation = "vertical")
#aimg = AsyncImage(source = "https://www.sololearn.com/Icons/Courses/1073.png")
#düzen.add_widget(aimg)
#return düzen
return Builder.load_string(kv)
foto().run()
Maalesef resimler o kadar cok ki resimler kucucuk kaliyor.(gerci resimlerin hepsi gozukuyor ama istedigim gibi degil,kullanicinin hosuna gitmez kullanici kullansa😊.)(bir de milyonlarca resim yuklendigini bi dusunun.Ne yaparim ben😊.)(bu sorunu asmak icin gridlayout kullanmayi denedim ama resimlerin boyutu yine istedigim gibi degildi(ama onceki kodunkine gore daha iyi denebilir),ayriyeten resimlerin bazilarini gostermiyordu.)Bu durum nasil halledilir acaba?
Cikti:
from kivy.app import App
from kivy.uix.image import AsyncImage
from kivy.lang import Builder
from kivy.metrics import dp
kv = """
ScrollView:
id: scr1
size_hint: 1,1
GridLayout:
id: grd1
cols: 3
spacing: 20
size_hint_y: None
size_hint_x: 1
height: max(self.minimum_height, scr1.height)
"""
class foto(App):
def on_start(self):
for i in range(60):
self.app.ids.grd1.add_widget(AsyncImage(source='http://wallpaper-gallery.net/images/wallpaper-for-android/wallpaper-for-android-24.jpg',
size_hint_y=None,
keep_ratio=False,
height= dp(200),
allow_stretch=True))
def build(self):
self.app=Builder.load_string(kv)
return self.app
foto().run()
1 Beğeni
Tam istedigim gibi.Tesekkurler.
Rica ederim.