IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GUI Python Discussion :

Mode Couleurs Kivy


Sujet :

GUI Python

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Points : 273
    Points
    273
    Par défaut Mode Couleurs Kivy
    Bonjour,
    j'ai écrit un code pour sélectionner des couleurs avec Kivy. Je ne sais pas quel est ce mode de couleur. Ce n'est ni du RGB, ni du HEX, ni du PMS, ni du CMJN... Pourriez-vous me dire son nom, svp? Et connaitriez-vous aussi une page web ou figure l'éventail de couleur?. Je voudrai obtenir le code de la couleur grise.

    exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    rose=[4.0, 1.7, 2.3, 1.0]
    noir=[0.0, 0.0, 0.0, 1.0]
    blanc=[3.0, 3.0, 3.0, 3.0]
    vert clair=[1.0, 3.6, 0.2, 1.0]
    vert pomme=[1.0, 1.6, 0.2, 1.0]
    marron=[1.0, 0.0, 0.0, 1.0]
    marron=[1.6, 0.6, 0.3, 1.0]
    orange=[4.0, 1.7, 0.3, 1.0]
    vert=[0.0, 1.7, 0.3, 1.0]
    vert-bleu=[0.0, 4.7, 3.3, 1.0]
    jaune=[3.0, 2.7, 0.3, 2.0]
    violet clair=[3.0, 0.7, 4.3, 2.0]
    rouge=[3.0, 0.7, 0.3, 1.0]
    mauve=[1.6, 0.6, 1.7, 1.0]

    couleurs.py

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    from kivy.app import App
    from kivy.uix.boxlayout import BoxLayout
    import pyperclip
     
    class RootWidget(BoxLayout):
     
        def copier(self):
            pyperclip.copy(self.ids["leCode"].text)
     
     
     
        def maCouleur() :
            #myColor = str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text)+","+str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text)+","+str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text)+","+str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text)+"."
            #self.ids["laCouleur"].background_color=myColor
            print(str(BoxLayout.ids["btn1"].text))
     
     
        def do_action2(self, arg):
                print(arg)
     
                def maCouleur() :
                    myColor = str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text)+","+str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text)+","+str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text)+","+str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text)+"."
     
                    myNewColor1=float(str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text))
                    myNewColor2=float(str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text))
                    myNewColor3=float(str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text))
                    myNewColor4=float(str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text))
     
                    myColor =[myNewColor1,myNewColor2,myNewColor3,myNewColor4]
                    self.ids["laCouleur"].background_color=myColor
                    self.ids["leCode"].text=str(myColor)
     
                if arg.text == "++":
                     b1=int(self.ids["btn1"].text)+1
                     self.ids["btn1"].text=str(b1)            
     
                if arg.text == "+":
                    if int(self.ids["btn2"].text)<9:
                        b3=int(self.ids["btn2"].text)+1
                        self.ids["btn2"].text=str(b3)
                    else:    
                        b1=int(self.ids["btn1"].text)+1
                        b3=0
                        self.ids["btn1"].text=str(b1)
                        self.ids["btn2"].text=str(b3) 
     
                if arg.text == "-":
                    if int(self.ids["btn2"].text)==0 and int(self.ids["btn1"].text)==0:
                        pass
                    elif int(self.ids["btn2"].text)>0:
                        b3=int(self.ids["btn2"].text)-1
                        self.ids["btn2"].text=str(b3)
                    else:            
                        b1=int(self.ids["btn1"].text)-1
                        b3=9
                        self.ids["btn1"].text=str(b1)
                        self.ids["btn2"].text=str(b3) 
     
                if arg.text == "--":
                    if int(self.ids["btn1"].text)==0:
                        pass
                    else:
                        b1=int(self.ids["btn1"].text)-1
                        self.ids["btn1"].text=str(b1)   
     
                maCouleur()
     
     
        def do_action3(self, arg):
                print(arg)
     
                def maCouleur() :
                    myColor = str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text)+","+str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text)+","+str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text)+","+str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text)+"."
     
                    myNewColor1=float(str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text))
                    myNewColor2=float(str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text))
                    myNewColor3=float(str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text))
                    myNewColor4=float(str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text))
     
                    myColor =[myNewColor1,myNewColor2,myNewColor3,myNewColor4]
                    self.ids["laCouleur"].background_color=myColor
                    self.ids["leCode"].text=str(myColor)
     
                if arg.text == "++":
                     print("C ICI")
                     b1=int(self.ids["btn3"].text)+1
                     self.ids["btn3"].text=str(b1)            
     
                if arg.text == "+":
                    if int(self.ids["btn4"].text)<9:
                        b3=int(self.ids["btn4"].text)+1
                        self.ids["btn4"].text=str(b3)
                    else:    
                        b1=int(self.ids["btn3"].text)+1
                        b3=0
                        self.ids["btn3"].text=str(b1)
                        self.ids["btn4"].text=str(b3) 
     
                if arg.text == "-":
                    if int(self.ids["btn4"].text)==0 and int(self.ids["btn3"].text)==0:
                        pass
                    elif int(self.ids["btn4"].text)>0:
                        b3=int(self.ids["btn4"].text)-1
                        self.ids["btn4"].text=str(b3)
                    else:            
                        b1=int(self.ids["btn3"].text)-1
                        b3=9
                        self.ids["btn3"].text=str(b1)
                        self.ids["btn4"].text=str(b3) 
     
                if arg.text == "--":
                    if int(self.ids["btn3"].text)==0:
                        pass
                    else:
                        b1=int(self.ids["btn3"].text)-1
                        self.ids["btn3"].text=str(b1)   
     
                maCouleur()
     
        def do_action4(self, arg):
                print(arg)
     
                def maCouleur() :
                    myColor = str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text)+","+str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text)+","+str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text)+","+str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text)+"."
     
                    myNewColor1=float(str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text))
                    myNewColor2=float(str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text))
                    myNewColor3=float(str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text))
                    myNewColor4=float(str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text))
     
                    myColor =[myNewColor1,myNewColor2,myNewColor3,myNewColor4]
                    self.ids["laCouleur"].background_color=myColor
                    self.ids["leCode"].text=str(myColor)
     
                if arg.text == "++":
                     b1=int(self.ids["btn5"].text)+1
                     self.ids["btn5"].text=str(b1)            
     
                if arg.text == "+":
                    if int(self.ids["btn6"].text)<9:
                        b3=int(self.ids["btn6"].text)+1
                        self.ids["btn6"].text=str(b3)
                    else:    
                        b1=int(self.ids["btn5"].text)+1
                        b3=0
                        self.ids["btn5"].text=str(b1)
                        self.ids["btn6"].text=str(b3) 
     
                if arg.text == "-":
                    if int(self.ids["btn6"].text)==0 and int(self.ids["btn5"].text)==0:
                        pass
                    elif int(self.ids["btn6"].text)>0:
                        b3=int(self.ids["btn6"].text)-1
                        self.ids["btn6"].text=str(b3)
                    else:            
                        b1=int(self.ids["btn5"].text)-1
                        b3=9
                        self.ids["btn5"].text=str(b1)
                        self.ids["btn6"].text=str(b3) 
     
                if arg.text == "--":
                    if int(self.ids["btn5"].text)==0:
                        pass
                    else:
                        b1=int(self.ids["btn5"].text)-1
                        self.ids["btn5"].text=str(b1)   
     
                maCouleur()
     
        def do_action5(self, arg):
                print(arg)
     
                def maCouleur() :
                    myColor = str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text)+","+str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text)+","+str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text)+","+str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text)+"."
     
                    myNewColor1=float(str(self.ids["btn1"].text)+"."+str(self.ids["btn2"].text))
                    myNewColor2=float(str(self.ids["btn3"].text)+"."+str(self.ids["btn4"].text))
                    myNewColor3=float(str(self.ids["btn5"].text)+"."+str(self.ids["btn6"].text))
                    myNewColor4=float(str(self.ids["btn7"].text)+"."+str(self.ids["btn8"].text))
     
                    myColor =[myNewColor1,myNewColor2,myNewColor3,myNewColor4]
                    self.ids["laCouleur"].background_color=myColor
                    self.ids["leCode"].text=str(myColor)
     
                if arg.text == "++":
                     b1=int(self.ids["btn7"].text)+1
                     self.ids["btn7"].text=str(b1)            
     
                if arg.text == "+":
                    if int(self.ids["btn8"].text)<9:
                        b3=int(self.ids["btn8"].text)+1
                        self.ids["btn8"].text=str(b3)
                    else:    
                        b1=int(self.ids["btn7"].text)+1
                        b3=0
                        self.ids["btn7"].text=str(b1)
                        self.ids["btn8"].text=str(b3) 
     
                if arg.text == "-":
                    if int(self.ids["btn8"].text)==0 and int(self.ids["btn7"].text)==0:
                        pass
                    elif int(self.ids["btn8"].text)>0:
                        b3=int(self.ids["btn8"].text)-1
                        self.ids["btn8"].text=str(b3)
                    else:            
                        b1=int(self.ids["btn7"].text)-1
                        b3=9
                        self.ids["btn7"].text=str(b1)
                        self.ids["btn8"].text=str(b3) 
     
                if arg.text == "--":
                    if int(self.ids["btn7"].text)==0:
                        pass
                    else:
                        b1=int(self.ids["btn7"].text)-1
                        self.ids["btn7"].text=str(b1)       
     
                maCouleur()
     
    class kutuApp(App):
        def build(self):
            return RootWidget()
     
     
    if __name__ == "__main__":
        kutuApp().run()
    couleurs.kv

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    <RootWidget>:
        orientation: "vertical"
        BoxLayout:
            size_hint_y: 0.2
            Button:
    			font_size: 36
                text: "Couleurs  KIVY"
                size_hint_x: 0.2
     
        BoxLayout:
            size_hint_y: 0.4		
            Button:
    			font_size: 36
    		    id: laCouleur
    		    size_hint_x: 0.9
                text: "Couleur"
            TextInput:		    
    		    id: leCode
                text: "Code"
    			font_size: 36
    			#size_hint_x: 0.2
    			multiline: False
    			size_hint_x: 0.4
     
    	    Button:
    		    id: CopieCode
    		    size_hint_x: 0.9
                text: "Copier"	
    			on_press: root.copier()
        GridLayout:
            cols: 7
            rows: 1
    		Button:
    			font_size: 36
                text: "--"
    			on_press: root.do_action2(self)
            Button:
    			font_size: 36
                text: "-"
    			on_press: root.do_action2(self)
            Button:
    			font_size: 36
    		    id: btn1
                text: "0"
    		Button:
    			font_size: 36
                text: "."			
    		Button:
    			font_size: 36
    		    id: btn2
                text: "0"	
            Button:
    			font_size: 36
                text: "+"
    			on_press: root.do_action2(self)
    		Button:
    			font_size: 36
                text: "++"
    			on_press: root.do_action2(self)	
        GridLayout:
            cols: 7
            rows: 1
    		Button:
    			font_size: 36
                text: "--"
    			on_press: root.do_action3(self)
            Button:
    			font_size: 36
                text: "-"
    			on_press: root.do_action3(self)
            Button:
    			font_size: 36
    		    id: btn3
                text: "0"
    		Button:
    			font_size: 36
                text: "."			
    		Button:
    			font_size: 36
    		    id: btn4
                text: "0"	
            Button:
    			font_size: 36
                text: "+"
    			on_press: root.do_action3(self)
    		Button:
    			font_size: 36
                text: "++"
    			on_press: root.do_action3(self)	
     
        GridLayout:
            cols: 7
            rows: 1
    		Button:
    			font_size: 36
                text: "--"
    			on_press: root.do_action4(self)
            Button:
    			font_size: 36
                text: "-"
    			on_press: root.do_action4(self)
            Button:
    			font_size: 36
    		    id: btn5
                text: "0"
    		Button:
    			font_size: 36
                text: "."			
    		Button:
    			font_size: 36
    		    id: btn6
                text: "0"	
            Button:
    			font_size: 36
                text: "+"
    			on_press: root.do_action4(self)
    		Button:
    			font_size: 36
                text: "++"
    			on_press: root.do_action4(self)				
     
        GridLayout:
            cols: 7
            rows: 1
    		Button:
    			font_size: 36
                text: "--"
    			on_press: root.do_action5(self)
            Button:
    			font_size: 36
                text: "-"
    			on_press: root.do_action5(self)
            Button:
    			font_size: 36
    		    id: btn7
                text: "0"
    		Button:
    			font_size: 36
                text: "."			
    		Button:
    			font_size: 36
    		    id: btn8
                text: "0"	
            Button:
    			font_size: 36
                text: "+"
    			on_press: root.do_action5(self)
    		Button:
    			font_size: 36
                text: "++"
    			on_press: root.do_action5(self)

  2. #2
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 273
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 273
    Points : 36 757
    Points
    36 757
    Par défaut
    Salut,

    Citation Envoyé par Arsene12 Voir le message
    j'ai écrit un code pour sélectionner des couleurs avec Kivy. Je ne sais pas quel est ce mode de couleur. Ce n'est ni du RGB, ni du HEX, ni du PMS, ni du CMJN... Pourriez-vous me dire son nom, svp? Et connaitriez-vous aussi une page web ou figure l'éventail de couleur?. Je voudrai obtenir le code de la couleur grise.
    Ouvrir la documentation (ou chercher sur Internet)...

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  3. #3
    Membre actif
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Points : 273
    Points
    273
    Par défaut
    Citation Envoyé par wiztricks Voir le message
    Salut,
    Ouvrir la documentation (ou chercher sur Internet)...
    - W
    Y'a aussi ce lien.

    Dans mon code, j'ai pas mis
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    from kivy.graphics import Color
    . Peut-être que le fichier .kv de kivy l'inclus automatiquement.. Je sais toujours pas ou se trouve le gris mais je vais chercher.

  4. #4
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 273
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 273
    Points : 36 757
    Points
    36 757
    Par défaut
    Citation Envoyé par Arsene12 Voir le message
    Dans mon code, j'ai pas mis
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    from kivy.graphics import Color
    . Peut-être que le fichier .kv de kivy l'inclus automatiquement.. Je sais toujours pas ou se trouve le gris mais je vais chercher.
    from kivy.graphics import Color définit juste la variable Color nécessaire que si vous l'utilisez.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

Discussions similaires

  1. Couleur en mode console
    Par Jabbal'H dans le forum C
    Réponses: 4
    Dernier message: 07/02/2006, 20h53
  2. Couleur orange en mode console
    Par Johannliebert dans le forum Windows
    Réponses: 2
    Dernier message: 07/02/2006, 12h54
  3. Modes de couleur 16-bits
    Par Mark53 dans le forum DirectX
    Réponses: 4
    Dernier message: 12/10/2004, 21h49
  4. Vitesse de transfert en mode VESA 800*600 256 couleurs
    Par chep dans le forum Assembleur
    Réponses: 9
    Dernier message: 28/05/2004, 11h53
  5. Des couleurs en mode console
    Par davcha dans le forum MFC
    Réponses: 3
    Dernier message: 08/05/2004, 14h37

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo