KivyGradient allows you to add a gradient color to your Kivy Widget
Project description
KivyGradient
KivyGradient allows you to add a gradient color to your Kivy Widget
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()
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()
Project details
Release history Release notifications | RSS feed
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.4.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for KivyGradient-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d3a8927f1428961c8bbfcba688bf06445d7d7b6f500c2408a29062f6921f26 |
|
MD5 | df91d06c1ac0d6c6efadf22666aafc48 |
|
BLAKE2b-256 | 440a94c95786f1f6b9909d6c2489f4581893f791edbee635596265b213504a7d |