Created
January 25, 2020 15:47
-
-
Save tshirtman/63944d186d7db76e5b2352424f2c9465 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.factory import Factory | |
KV = ''' | |
<NumInput@TextInput>: | |
value: 0 | |
size_hint_y: None | |
height: self.minimum_height | |
multiline: False | |
on_text_validate: | |
if self.text.isdigit: self.value = int(self.text) | |
else: self.text = '' | |
BoxLayout: | |
GridLayout: | |
pos_hint: {'center_y': .5} | |
size_hint_y: None | |
height: self.minimum_height | |
spacing: 20 | |
cols: 2 | |
Label: | |
text: 'H' | |
NumInput: | |
id: h | |
Label: | |
text: 'S' | |
NumInput: | |
id: s | |
Label: | |
text: 'V' | |
NumInput: | |
id: v | |
Widget: | |
canvas: | |
Color: | |
hsv: h.value / 360, s.value / 100, v.value / 100 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
''' | |
class Application(App): | |
def build(self): | |
return Builder.load_string(KV) | |
if __name__ == "__main__": | |
Application().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment