Outils pour utilisateurs

Outils du site


kivy_image_avec_alpha_sur_fond_blanc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
kivy_image_avec_alpha_sur_fond_blanc [2020/01/02 11:04] – créée sergekivy_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://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fressources.labomedia.org%2Fkivy_image_avec_alpha_sur_fond_blanc|English Version]]** **[[http://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fressources.labomedia.org%2Fkivy_image_avec_alpha_sur_fond_blanc|English Version]]**
 </WRAP> </WRAP>
 +<WRAP center round box 40% centeralign>
 +**[[les_pages_kivy_en_details|Les pages Kivy en détails]]**
 +</WRAP>
 +{{ media_05:kivy_fond_blanc.png?400 |}}
 +===== Arrière plan blanc sous une image avec canal alpha=====
  
 +<code python fond_blanc.py>
 +#! /usr/bin/env python3
 +# -*- coding: utf-8 -*-
  
-=====Quel est le problème=====+import kivy 
 +kivy.require('1.11.1')
  
 +from kivy.app import App
 +from kivy.uix.screenmanager import Screen
 +from kivy.properties import ListProperty
 +from kivy.lang import Builder
  
-{{tag>kivy sb}}+Builder.load_string(''' 
 +<Main>: 
 +    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: "labo.png" 
 +'''
 + 
 +class Main(Screen): 
 +    # Attibut de class accessible dans kv avec root.taille 
 +    taille = ListProperty([200, 200]) 
 + 
 +    # taille peut être modifié ensuite avec l'attribut self.taille 
 + 
 +class FondBlancApp(App): 
 +    def build(self): 
 +        return Main() 
 + 
 +if __name__ == '__main__': 
 +    FondBlancApp().run() 
 +</code> 
 + 
 +{{tag> kivy python sb }}
kivy_image_avec_alpha_sur_fond_blanc.1577963090.txt.gz · Dernière modification : 2020/01/02 11:04 de serge