Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h1>Thumbnail to Full Image</h1> <p>Make UrlBut create and store a thumbnail when it is instantiated. You can do this with <a href="http://www.pythonware.com/products/pil/" rel="nofollow"><code>PIL</code></a>, follow this tutorial <a href="http://andrius.miasnikovas.lt/2010/04/creating-thumbnails-from-photos-with-python-pil/" rel="nofollow">http://andrius.miasnikovas.lt/2010/04/creating-thumbnails-from-photos-with-python-pil/</a> </p> <p>Then, have the <code>on_press</code> method (or equivalent) create a pop-up or overlay that contains the full size image. </p> <h1>Treating the UrlBut as a Widget</h1> <p>Read this: <a href="http://kivy.org/docs/api-kivy.lang.html#syntax-of-template" rel="nofollow">http://kivy.org/docs/api-kivy.lang.html#syntax-of-template</a></p> <p>The Kivy docs say that a template defined in the kv file may be instantiated within your Python code like this (I am adapting the example given at that link):</p> <p>Your kv language template:</p> <pre><code>[UrlBut@ButtonBehavior+AsyncImage]: source: ctx.source button_grab: True on_press: eval(ctx.on_press) </code></pre> <p>Then in Python, you can instantiate the template with:</p> <pre><code>from kivy.lang import Builder urlbut1 = Builder.template('UrlBut',source='http://lorempixel.com/400/200') # create a second template with a different image urlbut2 = Builder.template('UrlBut', source='http://lorempixel.com/400/200') # and use urlbut1 and urlbut2 as other widgets. </code></pre> <p>Then, you could automate this with a for-loop:</p> <pre><code>for image_path in image_set: layout.add_widget(Builder.template('UrlBut',source="http://www.example/"'%s' % image_path) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload