Created
October 29, 2019 22:15
-
-
Save tshirtman/8fd52a660ac158d8edf6fb8cdddc7379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.lang import Builder | |
from kivy.uix.carousel import Carousel | |
from kivy.uix.floatlayout import FloatLayout | |
Builder.load_string(""" | |
#:import randint random.randint | |
<Content> | |
AsyncImage: | |
id: previous_image | |
source: "https://lorempixel.com/output/animals-q-c-800-600-{}.jpg".format(randint(1, 5)) | |
canvas.before: | |
StencilPush | |
RoundedRectangle: | |
size: root.width - dp(50), root.height - dp(50) | |
pos: dp(25), dp(25) | |
StencilUse | |
canvas.after: | |
StencilUnUse | |
RoundedRectangle: | |
size: root.width - dp(50), root.height - dp(50) | |
pos: dp(25), dp(25) | |
StencilPop | |
""") | |
class Content(FloatLayout): | |
pass | |
class Test(App): | |
def build(self): | |
slider = Carousel() | |
for x in range(10): | |
slider.add_widget(Content()) | |
return slider | |
if __name__ == '__main__': | |
Test().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment