kivy_image_avec_alpha_sur_fond_blanc
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
kivy_image_avec_alpha_sur_fond_blanc [2020/01/02 11:04] – créée serge | kivy_image_avec_alpha_sur_fond_blanc [2020/10/29 13:50] (Version actuelle) – ↷ Liens modifiés en raison d'un déplacement. serge | ||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
**[[http:// | **[[http:// | ||
</ | </ | ||
+ | <WRAP center round box 40% centeralign> | ||
+ | **[[les_pages_kivy_en_details|Les pages Kivy en détails]]** | ||
+ | </ | ||
+ | {{ media_05: | ||
+ | ===== Arrière plan blanc sous une image avec canal alpha===== | ||
+ | <code python fond_blanc.py> | ||
+ | #! / | ||
+ | # -*- coding: utf-8 -*- | ||
- | =====Quel est le problème===== | + | import kivy |
+ | kivy.require(' | ||
+ | from kivy.app import App | ||
+ | from kivy.uix.screenmanager import Screen | ||
+ | from kivy.properties import ListProperty | ||
+ | from kivy.lang import Builder | ||
- | {{tag> | + | Builder.load_string(''' |
+ | < | ||
+ | BoxLayout: | ||
+ | canvas.before: | ||
+ | Color: | ||
+ | rgb: 1, 1, 1 | ||
+ | Rectangle: | ||
+ | size: self.size | ||
+ | pos: self.pos | ||
+ | canvas: | ||
+ | Rectangle: | ||
+ | # self.size = taille du BoxLayout | ||
+ | size: root.taille | ||
+ | pos: 200, 200 | ||
+ | source: " | ||
+ | ''' | ||
+ | |||
+ | class Main(Screen): | ||
+ | # Attibut de class accessible dans kv avec root.taille | ||
+ | taille = ListProperty([200, | ||
+ | |||
+ | # taille peut être modifié ensuite avec l' | ||
+ | |||
+ | class FondBlancApp(App): | ||
+ | def build(self): | ||
+ | return Main() | ||
+ | |||
+ | if __name__ == ' | ||
+ | FondBlancApp().run() | ||
+ | </ | ||
+ | |||
+ | {{tag> kivy python |
kivy_image_avec_alpha_sur_fond_blanc.1577963090.txt.gz · Dernière modification : 2020/01/02 11:04 de serge