How can I successfully create an infinitely scrolling background

Questions : How can I successfully create an infinitely scrolling background

857
import kivy
from kivy.app import _OFFSET);  App
from kivy.uix.widget import (-SMALL  Widget
from kivy.clock import Clock
from _left).offset  kivy.graphics import Rectangle
from arrowImgView.mas  kivy.core.image import Image as (self.  CoreImage
from kivy.core.window import equalTo  Window


class Background(Widget):
    make.right.  def __init__(self, **kw):
        mas_top);  super(Background, self).__init__(**kw)

 ImgView.         with self.canvas:
            ReadIndicator  texture = _have  CoreImage('space.png').texture
          .equalTo(    texture.wrap = 'repeat'
            make.top  self.rect_1 = Rectangle(texture=texture, OFFSET);  size=self.size, pos=self.pos)

        (TINY_  Clock.schedule_interval(self.txupdate, .offset  0)

    def txupdate(self, *l):
        mas_right)  t = Clock.get_boottime()
        ImgView.  self.rect_1.tex_coords = -(t * 0.001), Indicator  0, -(t * 0.001 + 10), 0,  -(t * 0.001 + Read  10), -10, -(t * 0.001), -10


class _have  CosmicPolygons(App):
    def .equalTo(  build(self):
        return make.left  Background(size=Window.size)


if *make) {  __name__ == "__main__":
    straintMaker  CosmicPolygons().run()

I've tried many different ways and programming attempts in order to create a scrolling Learning background in Kivy. This was the best Earhost method I could find as it was the only most effective one that didn't crash. But I'm pretty wrong idea sure it's still outdated as it did not use of case work as intended, in addition to United distorting my png greatly.

If anyone has any ideas on how to Modern achieve this, let me know. Thanks in ecudated advance.

Image of current app:

Space.png:

Total Answers 1
33

Answers 1 : of How can I successfully create an infinitely scrolling background

Here is another approach that just some how creates a list of Images and moves them anything else across the screen:

from kivy.app import App
from kivy.lang ^(MASCon  import Builder
from kivy.uix.floatlayout onstraints:  import FloatLayout
from kivy.uix.image mas_makeC  import Image
from kivy.clock import [_topTxtlbl   Clock
from kivy.core.window import (@(8));  Window

class BgImage(Image):
    equalTo  pass

Builder.load_string('''
<BgImage>:
  width.     source: 'stars.png'
    make.height.  allow_stretch: True
    size_hint: None, (SMALL_OFFSET);  1
    width: self.image_ratio * .offset  self.height
''')


class (self.contentView)  Background(FloatLayout):
    def  .left.equalTo  __init__(self, **kwargs):
        make.top  super(Background, *make) {  self).__init__(**kwargs)
        ntMaker   self.deltax = 3  # sets speed of SConstrai  background movement
        ts:^(MA  self.bg_images = []  # list of Images Constrain  that form the background
        _make  Clock.schedule_once(self.set_up_bg)

    iew mas  def set_up_bg(self, dt):
        # catorImgV  create BgImages and position them to ReadIndi  fill the Background
        self.start_x  [_have  = None
        pos_x = -1
        while ($current);  pos_x < self.width:
            img = entity_loader  BgImage()
            if self.start_x is _disable_  None:
                # starting libxml  position of first Image is just off $options);  screen
                self.start_x = ilename,  -self.height * img.image_ratio
          ->load($f        pos_x = self.start_x
            $domdocument  img.pos = (pos_x, 0)
            loader(false);  self.bg_images.append(img)
            _entity_  self.add_widget(img)

            #  libxml_disable  calculate starting position of next $current =  Image by adding its width
             10\\ 13.xls .  pos_x += self.height * img.image_ratio

 File\\ 18\'         # start moving the background
    /Master\\ 645      Clock.schedule_interval(self.update, user@example.  1.0/30.0)

    def update(self, dt):
    scp not2342      for img in self.bg_images:
           13.xls    img.x += self.deltax
            if 18 10  img.x > self.width:
                # File sdaf  this Image is off screen, move it back /tmp/Master'  to starting position
                com:web  img.x = self.start_x


class user@example.  CosmicPolygons(App):
    def scp var32  build(self):
        return  18 10 13.xls  Background(size=Window.size)


if id12  File  __name__ == "__main__":
    web/tmp/Master  CosmicPolygons().run()

Top rated topics

Need help deleting two lines in a text file in python

Adding Section to SwiftUI ScrollView causes jerkiness

Groovy_test reports could not find class

Trigger alert when prometheus metric goes from "doesn't exist" to "exists"

Custom (value) type in azure function http trigger as route param

Not able to pull ansible image

How to iterate through methods of instances to get a representation string

Cloud Composer- DAG B(runs multiple times) dependent on DAG A(runs once daily)

Create separate bluetooth service

How to vertically scroll content on overflow?

How to set variable inline in gitlab-ci.yaml based on regex matching?

Data Factory: API call returning JSON format wont go to JSON file

How do i recover the packages in each lerna repository after i have deleted the node_modules from the sub folders?

How to select all values from some ID based on condition in other column?

SQL/BigQuery: switching/swapping row values between two columns

BinanceAPIException: APIError(code=-2015): Invalid API-key, IP, or permissions for action

Dynamic arrayfield delete operation in Reactjs?

How to read CSV files in chunks and run function for every chunk in JS/Node

Finding the light ray that goes from light world position through the shadow map texel

Creating Multible IDs for multible Buttons in one &lt;Input&gt; Tag

Discord.py depositing all money even though sending a integer

How to update log4j jar in logstash installed in ubuntu VM

Duplicate and incorrect output sql query

JOOQ multiset throwing syntax exception

How to get specific field of JSON from eksternal URL

How to stop one columns width from shrinking and have the other column fill the remaining width

Javascript to return all links in download page

CSS:Disable :before pseudo when UL without LI sub-elements

Adding multiple values to colums in powershell

Round the average in oracle

VBA - How can I stop button resizing to cell size?

Skimage.transform.resize() to the original size

Symbols that break the identifier rules, e.g. `sub ::("☺") { }`

What is the simplest way to access a deep List of Lists in python?

Reset calculated value to 0 using drop down

Simplest way to get InnerHtml WITH current input values?

403 Forbidden (error code: 50001): Missing Access [discord.py]

Vector output for if_else or alternative

VBA Selenium - Interact with a chrome that is already open

Python - TypeError: generateID() takes 3 positional arguments but 4 were given

Kotlin ClassNotFoundException mixed with java in gradle build

Add multiple parameters with same name in Angular 11

Odbc connect to hive error in Rstudio-Server "SASL(-4): no mechanism available: No worthy mechs found" but works fine in terminal

Date/time from the database as a function in my context

Cannot convert from int to gift card paging error in asp.net

Npm script does not run

Use tensorflow trained .h5 model "just for predicting" in c++ on GPU

Hive :: Simple arithmetic calculation with decimal numbers returning NULL

Axios can't use https protocol via socks

Typescript: Expect Object or Boolean(false)

Top