Read: https://kivy.org/doc/stable/api-kivy.uix.scatter.html?highlight=scatter#module-kivy.uix.scatter
Â
I suspect what you want is the bbox. Â Â See: https://kivy.org/doc/stable/api-kivy.uix.scatter.html?highlight=scatter#kivy.uix.scatter.Scatter.bbox
Â
There is an example of a scatter in the kivy-examples directory: venv/share/kivy-examples/widgets/scatter.py, and scatter.kv
It provides an interactive display of the scatter parameters.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/d872b1af-9f29-4b06-818e-8858cefc2161n%40googlegroups.com.
Â
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/641dc080.050a0220.a8a53.bd19SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On Mar 24, 2023, at 8:54 AM, Siva 14 <sivau...@gmail.com> wrote:

To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAKvwAvKBupcqo1A0Nu5rPsE8DUHsWw4Q1GtdrV6yNNQPpNHV2A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/4570301C-F8C6-4B42-8640-2FA030DF2CA7%40cox.net.
Here is an example. I am using time.sleep to simulate the download.
Â
from kivy.app import App
from kivy.lang import Builder
import time
from threading import Thread
kv = """
AnchorLayout:
   BoxLayout:
       size_hint: None, None
       size: 300, 48 * 2
       orientation: 'vertical'
       BoxLayout:
           Button:
               text: 'Not Threaded'
               on_release: app.not_threaded()
           Button:
               text: 'Threaded'
               on_release: app.threaded()
       Button:
           text: 'Test'
           on_release: print('Test Button Pressed')
"""
class ThreadSleepApp(App):
   def build(self):
       return Builder.load_string(kv)
   def threaded(self):
       t = Thread(target=self.download)
       t.start() # start the download thread
   def download(self): # simulating your download function...
       print('starting the threaded download...')
       time.sleep(10)
       print('Download complete')
   def not_threaded(self):
       print('start non-threaded download')
       time.sleep(10)
       print('Finished non-threaded download')
ThreadSleepApp().run()
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAKvwAvJhCPcOS4thStYwJBc4vTCjrCEcEAqNUh_2t7wqvt5LFA%40mail.gmail.com.
Â
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/641e1738.050a0220.3ead9.d896SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On Mar 24, 2023, at 6:13 PM, Siva 14 <sivau...@gmail.com> wrote:

To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAKvwAvLD%3DmtriG4HvYhjjAfs4RBwWQtWSPuGvAYF-%2BQsLF8jRA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/08F8BA7E-12B9-4FE8-B42E-18FF65A7FA3F%40cox.net.
Try something like this:
Â
def _download(self): # this is your original download method, renamed to _download
   link = self.root.ids.ytbar.text
   clarity = self.root.ids.oop.text
   vdo = YouTube(link)
   video = vdo.streams.filter(res=clarity).first() # renamed Download to video
   video.download()
def download(self):
   t = threading.Thread(target=self._download)
   t.start()
  Â
Â
I renamed your original method download to _download. I created a new method download, that creates and starts the download thread.
In the _download method, I renamed Download to video. In python the naming convention is that CapWords are used for Class definitions, see: https://pep8.org/#class-names , method and instance variables use snake_case.
Â
I have not run this code, I am assuming your original download method worked as you intended.
Â
Here is how to think about this conceptually. A thread is another thread of execution. It is running concurrently with other code in your program. You create the thread by passing the callable (function or method) to the Thread class constructor. Then call the start method on the thread object. This code will run concurrently with the kivy event loop.  Threads all share the same address space.
Â
Let me know if this helps.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAKvwAvLSd5ZDUNsSRfPaB7eke0z-Qh8B59fyxG878O3Wn4aRBw%40mail.gmail.com.
Â
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/64206374.5d0a0220.c0beb.bb9dSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
If you want it to run faster, you could use multi-processing. This adds a number of complexities. If you decide to try it, I would recommend storing the video in a file,  it will be easier to share.Â
Â
With multi-processing, the download code would run on a separate CPU core. This can improve performance but each process has it’s own address space, this make sharing data more complex. Here is a simple multi-processing app I created with a few of the key learnings captured in the readme.Â
https://github.com/ElliotGarbus/MidiClockGenerator
Â
Pay special attention to: __name__ will get a different name in the process that is created by the program (__mp_main__). The test "if __name__ == '__main__':" prevents the kiy code from being loaded in both processes. If this 'guard' is not in place, the app will create 2 windows.
Â
I don’t know enough about your app to have an opinion on if you should try this or not. If you want to download a number of videos in the background, without impacting the UI, this would be the way to go. If you are downloading one video at a time and waiting for the result, create a progress bar or other indication to the user that the file is downloading.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAKvwAvJwyt-zwvAerGjVidEFkgnLKYKgEBLj5_eVKeS4MCne0A%40mail.gmail.com.
Â