Skip to main content

KivyGradient allows you to add a gradient color to your Kivy Widget

Project description

KivyGradient

Verified on Openbase Featured on Openbase KivyGradient Versions

KivyGradient allows you to add a gradient color to your Kivy Widget

Install

pip install kivygradient

Example Code

from kivy.app import App
from kivy.lang import Builder


kv = """
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import Gradient kivy_gradient.Gradient
RelativeLayout:
    BoxLayout
        id: box
        on_kv_post: print(get_color_from_hex("E91E63"))
        canvas:
            Rectangle:
                size: self.size
                pos: self.pos
                texture: Gradient.horizontal(get_color_from_hex("E91E63"), get_color_from_hex("FCE4EC"))
"""


class Test(App):
    def build(self):
        return Builder.load_string(kv)

    def on_stop(self):
        self.root.ids.box.export_to_png("gradient.png")
        

Test().run()

gradient

from kivy.app import App
from kivy.lang import Builder


kv = """
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import Gradient kivy_gradient.Gradient
RelativeLayout:
    BoxLayout
        id: box
        canvas:
            Rectangle:
                size: self.size
                pos: self.pos
                texture: 
                    Gradient.horizontal(
                    get_color_from_hex("E91E63"), 
                    get_color_from_hex("FCE4EC"), 
                    get_color_from_hex("2962FF")
                    )
"""


class Test(App):
    def build(self):
        return Builder.load_string(kv)

    def on_stop(self):
        self.root.ids.box.export_to_png("gradient.png")
        

Test().run()

gradient

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kivygradient-0.0.5.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

KivyGradient-0.0.5-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file kivygradient-0.0.5.tar.gz.

File metadata

  • Download URL: kivygradient-0.0.5.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for kivygradient-0.0.5.tar.gz
Algorithm Hash digest
SHA256 fe41e5e701540aebd90b3c3dcbe8cf0d5bc28bb6dd9a9551afd38a09ef2181f8
MD5 150713a4bf3751a3492ebdc031ad6db5
BLAKE2b-256 1a21778ab6c80cea719963304981ce2a7a7da0d85f95f87f1714220d41a33094

See more details on using hashes here.

File details

Details for the file KivyGradient-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for KivyGradient-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4d564a6d9ac7ca50c0f4288dfec47e176341eeb372dd901304fbf158b64d781c
MD5 925a40726a93f21b689907e52bb0036e
BLAKE2b-256 3381ddd630301ab7fd98da114698971422051c57193b64118b14ddfcde5586ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page