Skip to main content

How to create a 3d Rubic's cube in python using tkinter

 In this blog post, I will show you how to create a 3d rubic's cube in python using tkinter, a standard GUI library for python. Tkinter provides various widgets and methods to create graphical user interfaces. A 3d rubic's cube is a popular puzzle game that consists of a cube with six faces, each divided into nine smaller squares of different colors. The goal is to rotate the faces of the cube until each face has only one color.


To create a 3d rubic's cube in python using tkinter, we will need to use the following steps:


1. Import the tkinter module and create a root window.

2. Create a canvas widget to draw the cube on.

3. Define the coordinates and colors of the vertices and faces of the cube.

4. Define a function to draw the cube on the canvas using polygons.

5. Define a function to rotate the cube along the x, y or z axis using matrix multiplication.

6. Define a function to handle keyboard events and call the rotation function accordingly.

7. Bind the keyboard events to the root window and start the main loop.


Let's see the code for each step in detail.


Step 1: Import the tkinter module and create a root window.


We start by importing the tkinter module as tk and creating a root window with a title and a size.

Here's the code:


from tkinter import *
from random import *


(couleur)=['red','blue','yellow','white','orange','green']




red='red'
orange='orange'
white='white'
green='green'
yellow='yellow'
blue='blue'


CC=[]  
cm1=[] 





ag= int(input(' Enter 0 for display 2D or 1 for display 3D '))

a = 800
b = 1100
i = int(a/12)
j = int(a/12)
x = int(a/22.5)
y = int(b/30)

fenetre = Tk()
fenetre.geometry(str(b)+"x"+str(a))
fenetre.title("Rubik's Cube")
fond = Canvas(fenetre, width=b , heigh=a ,bg='#E4E4E4')
fond.pack(side=LEFT)



def CubeResolue() :
    global cr,red,orange,white,green,yellow,blue,CC
    cr=[[[red,red,red],[red,red,red],[red,red,red]],
        [[orange,orange,orange],[orange,orange,orange],[orange,orange,orange]],
        [[white,white,white],[white,white,white],[white,white,white]],
        [[green,green,green],[green,green,green],[green,green,green]],
        [[yellow,yellow,yellow],[yellow,yellow,yellow],[yellow,yellow,yellow]],
        [[blue,blue,blue],[blue,blue,blue],[blue,blue,blue]]]
    CC=cr

CubeResolue ()



def AfficheGraphique ():
    global a,b,x,y



    F1C1=fond.create_rectangle(4*i , 1*j , 5*i , 2*j ,  outline='black' , fill=CC [0] [0] [0])
    F1C2=fond.create_rectangle(4*i , 2*j , 5*i , 3*j ,  outline='black' , fill=CC [0] [0] [1])
    F1C3=fond.create_rectangle(4*i , 3*j , 5*i , 4*j ,  outline='black' , fill=CC [0] [0] [2])
    F1C4=fond.create_rectangle(5*i , 1*j , 6*i , 2*j ,  outline='black' , fill=CC [0] [1] [0])
    F1C5=fond.create_rectangle(5*i , 2*j , 6*i , 3*j ,  outline='black' , fill=CC [0] [1] [1])
    F1C6=fond.create_rectangle(5*i , 3*j , 6*i , 4*j ,  outline='black' , fill=CC [0] [1] [2])
    F1C7=fond.create_rectangle(6*i , 1*j , 7*i , 2*j ,  outline='black' , fill=CC [0] [2] [0])
    F1C8=fond.create_rectangle(6*i , 2*j , 7*i , 3*j ,  outline='black' , fill=CC [0] [2] [1])
    F1C9=fond.create_rectangle(6*i , 3*j , 7*i , 4*j ,  outline='black' , fill=CC [0] [2] [2])



    F2C1=fond.create_rectangle(4*i , 7*j , 5*i , 8*j  , outline='black' , fill=CC [1] [0] [0])
    F2C2=fond.create_rectangle(4*i , 8*j , 5*i , 9*j  , outline='black' , fill=CC [1] [0] [1])
    F2C3=fond.create_rectangle(4*i , 9*j , 5*i , 10*j , outline='black' , fill=CC [1] [0] [2])
    F2C4=fond.create_rectangle(5*i , 7*j , 6*i , 8*j  , outline='black' , fill=CC [1] [1] [0])
    F2C5=fond.create_rectangle(5*i , 8*j , 6*i , 9*j  , outline='black' , fill=CC [1] [1] [1])
    F2C6=fond.create_rectangle(5*i , 9*j , 6*i , 10*j , outline='black' , fill=CC [1] [1] [2])
    F2C7=fond.create_rectangle(6*i , 7*j , 7*i , 8*j  , outline='black' , fill=CC [1] [2] [0])
    F2C8=fond.create_rectangle(6*i , 8*j , 7*i , 9*j  , outline='black' , fill=CC [1] [2] [1])
    F2C9=fond.create_rectangle(6*i , 9*j , 7*i , 10*j , outline='black' , fill=CC [1] [2] [2])



    F3C1=fond.create_rectangle(1*i , 4*j , 2*i , 5*j ,  outline='black' , fill=CC [2] [0] [0])
    F3C2=fond.create_rectangle(1*i , 5*j , 2*i , 6*j ,  outline='black' , fill=CC [2] [0] [1])
    F3C3=fond.create_rectangle(1*i , 6*j , 2*i , 7*j ,  outline='black' , fill=CC [2] [0] [2])
    F3C4=fond.create_rectangle(2*i , 4*j , 3*i , 5*j ,  outline='black' , fill=CC [2] [1] [0])
    F3C5=fond.create_rectangle(2*i , 5*j , 3*i , 6*j ,  outline='black' , fill=CC [2] [1] [1])
    F3C6=fond.create_rectangle(2*i , 6*j , 3*i , 7*j ,  outline='black' , fill=CC [2] [1] [2])
    F3C7=fond.create_rectangle(3*i , 4*j , 4*i , 5*j ,  outline='black' , fill=CC [2] [2] [0])
    F3C8=fond.create_rectangle(3*i , 5*j , 4*i , 6*j ,  outline='black' , fill=CC [2] [2] [1])
    F3C9=fond.create_rectangle(3*i , 6*j , 4*i , 7*j ,  outline='black' , fill=CC [2] [2] [2])



    F4C1=fond.create_rectangle(4*i , 4*j , 5*i , 5*j ,  outline='black' , fill=CC [3] [0] [0])
    F4C2=fond.create_rectangle(4*i , 5*j , 5*i , 6*j ,  outline='black' , fill=CC [3] [0] [1])
    F4C3=fond.create_rectangle(4*i , 6*j , 5*i , 7*j ,  outline='black' , fill=CC [3] [0] [2])
    F4C4=fond.create_rectangle(5*i , 4*j , 6*i , 5*j ,  outline='black' , fill=CC [3] [1] [0])
    F4C5=fond.create_rectangle(5*i , 5*j , 6*i , 6*j ,  outline='black' , fill=CC [3] [1] [1])
    F4C6=fond.create_rectangle(5*i , 6*j , 6*i , 7*j ,  outline='black' , fill=CC [3] [1] [2])
    F4C7=fond.create_rectangle(6*i , 4*j , 7*i , 5*j ,  outline='black' , fill=CC [3] [2] [0])
    F4C8=fond.create_rectangle(6*i , 5*j , 7*i , 6*j ,  outline='black' , fill=CC [3] [2] [1])
    F4C9=fond.create_rectangle(6*i , 6*j , 7*i , 7*j ,  outline='black' , fill=CC [3] [2] [2])


    F5C1=fond.create_rectangle(7*i , 4*j , 8*i , 5*j ,  outline='black' , fill=CC [4] [0] [0])
    F5C2=fond.create_rectangle(7*i , 5*j , 8*i , 6*j ,  outline='black' , fill=CC [4] [0] [1])
    F5C3=fond.create_rectangle(7*i , 6*j , 8*i , 7*j ,  outline='black' , fill=CC [4] [0] [2])
    F5C4=fond.create_rectangle(8*i , 4*j , 9*i , 5*j ,  outline='black' , fill=CC [4] [1] [0])
    F5C5=fond.create_rectangle(8*i , 5*j , 9*i , 6*j ,  outline='black' , fill=CC [4] [1] [1])
    F5C6=fond.create_rectangle(8*i , 6*j , 9*i , 7*j ,  outline='black' , fill=CC [4] [1] [2])
    F5C7=fond.create_rectangle(9*i , 4*j , 10*i , 5*j , outline='black' , fill=CC [4] [2] [0])
    F5C8=fond.create_rectangle(9*i , 5*j , 10*i , 6*j , outline='black' , fill=CC [4] [2] [1])
    F5C9=fond.create_rectangle(9*i , 6*j , 10*i , 7*j , outline='black' , fill=CC [4] [2] [2])
    


    F6C1=fond.create_rectangle(10*i , 4*j , 11*i , 5*j ,outline='black' , fill=CC [5] [0] [0])
    F6C2=fond.create_rectangle(10*i , 5*j , 11*i , 6*j ,outline='black' , fill=CC [5] [0] [1])
    F6C3=fond.create_rectangle(10*i , 6*j , 11*i , 7*j ,outline='black' , fill=CC [5] [0] [2])
    F6C4=fond.create_rectangle(11*i , 4*j , 12*i , 5*j ,outline='black' , fill=CC [5] [1] [0])
    F6C5=fond.create_rectangle(11*i , 5*j , 12*i , 6*j ,outline='black' , fill=CC [5] [1] [1])
    F6C6=fond.create_rectangle(11*i , 6*j , 12*i , 7*j ,outline='black' , fill=CC [5] [1] [2])
    F6C7=fond.create_rectangle(12*i , 4*j , 13*i , 5*j ,outline='black' , fill=CC [5] [2] [0])
    F6C8=fond.create_rectangle(12*i , 5*j , 13*i , 6*j ,outline='black' , fill=CC [5] [2] [1])
    F6C9=fond.create_rectangle(12*i , 6*j , 13*i , 7*j ,outline='black' , fill=CC [5] [2] [2])




def AfficheGraphique3D ():
    
    c = 2*x
    d = 2*y
    


    F1C1=fond.create_polygon(c+4.32*x ,  d+2*y ,     c+2.66*x ,  d+2.66*y , c+1*x ,    d+2*y ,    c+2.66*x ,    d+1.34*y  ,outline='black' ,  fill=CC [0] [0] [0])
    F1C2=fond.create_polygon(c+5.98*x ,  d+2.66*y ,  c+4.32*x ,  d+3.33*y , c+2.66*x , d+2.66*y , c+4.32*x ,    d+2*y     ,outline='black' ,  fill=CC [0] [0] [1])
    F1C3=fond.create_polygon(c+7.66*x ,  d+3.34*y ,  c+6*x ,     d+4*y ,    c+4.32*x , d+3.33*y , c+5.98*x ,    d+2.66*y  ,outline='black' ,  fill=CC [0] [0] [2])
    F1C4=fond.create_polygon(c+5.98*x ,  d+1.34*y ,  c+4.32*x ,  d+2*y ,    c+2.66*x , d+1.34*y , c+4.32*x ,    d+0.66*y  ,outline='black' ,  fill=CC [0] [1] [0])
    F1C5=fond.create_polygon(c+7.66*x ,  d+2*y ,     c+5.98*x ,  d+2.66*y , c+4.32*x , d+2*y ,    c+5.98*x ,    d+1.34*y  ,outline='black' ,  fill=CC [0] [1] [1])
    F1C6=fond.create_polygon(c+9.32*x ,  d+2.67*y ,  c+7.66*x ,  d+3.34*y , c+5.98*x , d+2.66*y , c+7.64*x ,    d+2*y     ,outline='black' ,  fill=CC [0] [1] [2])
    F1C7=fond.create_polygon(c+7.66*x ,  d+0.66*y ,  c+5.98*x ,  d+1.34*y , c+4.32*x , d+0.67*y , c+6*x ,       d+0*y     ,outline='black' ,  fill=CC [0] [2] [0])
    F1C8=fond.create_polygon(c+9.32*x ,  d+1.33*y ,  c+7.64*x ,  d+2*y ,    c+5.98*x , d+1.34*y , c+7.66*x ,    d+0.66*y  ,outline='black' ,  fill=CC [0] [2] [1])
    F1C9=fond.create_polygon(c+11*x ,    d+2*y ,     c+9.32*x ,  d+2.67*y , c+7.64*x , d+2*y ,    c+9.32*x ,    d+1.33*y  ,outline='black' ,  fill=CC [0] [2] [2])



    F2C1=fond.create_polygon(c+22*x ,    d+2*y ,     c+20.32*x , d+2.67*y , c+18.64*x , d+2*y ,    c+20.32*x ,  d+1.33*y  ,outline='black' ,  fill=CC [1] [0] [0])
    F2C2=fond.create_polygon(c+20.32*x , d+2.67*y ,  c+18.66*x , d+3.34*y , c+16.98*x , d+2.66*y , c+18.64*x ,  d+2*y     ,outline='black' ,  fill=CC [1] [1] [0])
    F2C3=fond.create_polygon(c+18.66*x , d+3.34*y ,  c+17*x ,    d+4*y ,    c+15.32*x , d+3.33*y , c+16.98*x ,  d+2.66*y  ,outline='black' ,  fill=CC [1] [2] [0])
    F2C4=fond.create_polygon(c+20.32*x , d+1.33*y ,  c+18.64*x , d+2*y ,    c+16.98*x , d+1.34*y , c+18.66*x ,  d+0.66*y  ,outline='black' ,  fill=CC [1] [0] [1])
    F2C5=fond.create_polygon(c+18.66*x , d+2*y ,     c+16.98*x , d+2.66*y , c+15.32*x , d+2*y ,    c+16.98*x ,  d+1.34*y  ,outline='black' ,  fill=CC [1] [1] [1])
    F2C6=fond.create_polygon(c+16.98*x , d+2.66*y ,  c+15.32*x , d+3.33*y , c+13.66*x , d+2.66*y , c+15.32*x ,  d+2*y     ,outline='black' ,  fill=CC [1] [2] [1])
    F2C7=fond.create_polygon(c+18.66*x , d+0.66*y ,  c+16.98*x , d+1.34*y , c+15.32*x , d+0.67*y , c+17*x ,     d+0*y     ,outline='black' ,  fill=CC [1] [0] [2])
    F2C8=fond.create_polygon(c+16.98*x , d+1.34*y ,  c+15.32*x , d+2*y ,    c+13.66*x , d+1.34*y , c+15.32*x ,  d+0.67*y  ,outline='black' ,  fill=CC [1] [1] [2])
    F2C9=fond.create_polygon(c+15.32*x , d+2*y ,     c+13.66*x , d+2.66*y , c+12*x ,    d+2*y ,    c+13.66*x ,  d+1.34*y  ,outline='black' ,  fill=CC [1] [2] [2])    




    F3C1=fond.create_polygon(c+2.66*x ,  d+5.03*y ,  c+1*x ,     d+4.36*y ,  c+1*x ,    d+2*y ,    c+2.66*x ,   d+2.66*y  ,outline='black' ,  fill=CC [2] [0] [0])
    F3C2=fond.create_polygon(c+2.66*x ,  d+7.36*y ,  c+1*x ,     d+6.66*y ,  c+1*x ,    d+4.36*y , c+2.66*x ,   d+5.03*y  ,outline='black' ,  fill=CC [2] [0] [1])
    F3C3=fond.create_polygon(c+2.66*x ,  d+9.66*y ,  c+1*x ,     d+9*y ,     c+1*x ,    d+6.66*y , c+2.66*x ,   d+7.32*y  ,outline='black' ,  fill=CC [2] [0] [2])
    F3C4=fond.create_polygon(c+4.32*x ,  d+5.69*y ,  c+2.66*x ,  d+5.03*y ,  c+2.66*x , d+2.66*y , c+4.32*x ,   d+3.33*y  ,outline='black' ,  fill=CC [2] [1] [0])
    F3C5=fond.create_polygon(c+4.32*x ,  d+8.02*y ,  c+2.66*x ,  d+7.36*y ,  c+2.66*x , d+5.03*y , c+4.32*x ,   d+5.69*y  ,outline='black' ,  fill=CC [2] [1] [1])
    F3C6=fond.create_polygon(c+4.32*x ,  d+10.33*y , c+2.66*x ,  d+9.66*y ,  c+2.66*x , d+7.36*y , c+4.32*x ,   d+8.02*y  ,outline='black' ,  fill=CC [2] [1] [2])
    F3C7=fond.create_polygon(c+6*x ,     d+6.33*y ,  c+4.32*x ,  d+5.69*y ,  c+4.32*x , d+3.33*y , c+6*x ,      d+4*y     ,outline='black' ,  fill=CC [2] [2] [0])
    F3C8=fond.create_polygon(c+6*x ,     d+8.66*y ,  c+4.32*x ,  d+8.02*y ,  c+4.32*x , d+5.69*y , c+6*x ,      d+6.33*y  ,outline='black' ,  fill=CC [2] [2] [1])
    F3C9=fond.create_polygon(c+6*x ,     d+11*y ,    c+4.32*x ,  d+10.33*y , c+4.32*x , d+8.02*y , c+6*x ,      d+8.66*y  ,outline='black' ,  fill=CC [2] [2] [2])      



    F4C1=fond.create_polygon(c+7.66*x ,  d+5.69*y ,  c+6*x ,     d+6.33*y ,   c+6*x ,    d+4*y ,    c+7.66*x ,  d+3.33*y  ,outline='black' ,  fill=CC [3] [0] [0])
    F4C2=fond.create_polygon(c+7.66*x ,  d+8.02*y ,  c+6*x ,     d+8.66*y ,   c+6*x,     d+6.33*y , c+7.66*x,   d+5.69*y  ,outline='black' ,  fill=CC [3] [0] [1])
    F4C3=fond.create_polygon(c+7.66*x ,  d+10.33*y , c+6*x ,     d+11*y ,     c+6*x ,    d+8.66*y , c+7.66*x ,  d+8.02*y  ,outline='black' ,  fill=CC [3] [0] [2])
    F4C4=fond.create_polygon(c+9.32*x ,  d+5.04*y ,  c+7.66*x ,  d+5.7*y ,    c+7.66*x , d+3.34*y , c+9.32*x ,  d+2.67*y  ,outline='black' ,  fill=CC [3] [1] [0])
    F4C5=fond.create_polygon(c+9.32*x ,  d+7.34*y ,  c+7.66*x ,  d+8*y ,      c+7.66*x , d+5.7*y ,  c+9.32*x ,  d+5.04*y  ,outline='black' ,  fill=CC [3] [1] [1])
    F4C6=fond.create_polygon(c+9.32*x ,  d+9.67*y ,  c+7.66*x ,  d+10.33*y ,  c+7.66*x , d+8*y ,    c+9.32*x ,  d+7.33*y  ,outline='black' ,  fill=CC [3] [1] [2])
    F4C7=fond.create_polygon(c+11*x ,    d+4.36*y ,  c+9.32*x ,  d+5.04*y ,   c+9.32*x , d+2.67*y , c+11*x ,    d+2*y     ,outline='black' ,  fill=CC [3] [2] [0])
    F4C8=fond.create_polygon(c+11*x ,    d+6.67*y ,  c+9.32*x ,  d+7.34*y ,   c+9.32*x , d+5.04*y , c+11*x ,    d+4.36*y  ,outline='black' ,  fill=CC [3] [2] [1])
    F4C9=fond.create_polygon(c+11*x ,    d+9*y ,     c+9.32*x ,  d+9.67*y ,   c+9.32*x , d+7.33*y , c+11*x ,    d+6.66*y  ,outline='black' ,  fill=CC [3] [2] [2])
  


    F5C1=fond.create_polygon(c+18.66*x , d+5.66*y ,  c+17*x ,    d+6.33*y ,  c+17*x ,    d+4*y ,    c+18.66*x , d+3.33*y  ,outline='black' ,  fill=CC [5] [0] [0])
    F5C2=fond.create_polygon(c+18.66*x , d+8*y ,     c+17*x ,    d+8.66*y ,  c+17*x ,    d+6.33*y , c+18.66*x , d+5.66*y  ,outline='black' ,  fill=CC [5] [0] [1])
    F5C3=fond.create_polygon(c+18.66*x , d+10.33*y , c+17*x ,    d+11*y ,    c+17*x ,    d+8.66*y , c+18.66*x , d+8*y     ,outline='black' ,  fill=CC [5] [0] [2])
    F5C4=fond.create_polygon(c+20.32*x , d+5*y ,     c+18.66*x , d+5.66*y ,  c+18.66*x , d+3.33*y , c+20.32*x , d+2.66*y  ,outline='black' ,  fill=CC [5] [1] [0])
    F5C5=fond.create_polygon(c+20.32*x , d+7.33*y ,  c+18.66*x , d+8*y ,     c+18.66*x , d+5.66*y , c+20.32*x , d+5*y     ,outline='black' ,  fill=CC [5] [1] [1])
    F5C6=fond.create_polygon(c+20.32*x , d+9.66*y ,  c+18.66*x , d+10.33*y , c+18.66*x , d+8*y ,    c+20.32*x , d+7.33*y  ,outline='black' ,  fill=CC [5] [1] [2])
    F5C7=fond.create_polygon(c+22*x ,    d+4.36*y ,  c+20.32*x , d+5*y ,     c+20.32*x , d+2.66*y , c+22*x ,    d+2*y     ,outline='black' ,  fill=CC [5] [2] [0])
    F5C8=fond.create_polygon(c+22*x ,    d+6.66*y ,  c+20.32*x , d+7.33*y ,  c+20.32*x , d+5*y ,    c+22*x ,    d+4.36*y  ,outline='black' ,  fill=CC [5] [2] [1])
    F5C9=fond.create_polygon(c+22*x ,    d+9*y ,     c+20.32*x , d+9.66*y ,  c+20.32*x , d+7.33*y , c+22*x ,    d+6.66*y  ,outline='black' ,  fill=CC [5] [2] [2])


    F6C1=fond.create_polygon(c+13.66*x , d+5*y ,     c+12*x ,    d+4.36*y ,  c+12*x ,    d+2*y ,    c+13.66*x , d+2.66*y  ,outline='black' ,  fill=CC [4] [2] [0])
    F6C2=fond.create_polygon(c+13.66*x , d+7.32*y ,  c+12*x ,    d+6.66*y ,  c+12*x ,    d+4.36*y , c+13.66*x , d+5*y     ,outline='black' ,  fill=CC [4] [2] [1]) 
    F6C3=fond.create_polygon(c+13.66*x , d+9.66*y ,  c+12*x ,    d+9*y ,     c+12*x ,    d+6.66*y , c+13.66*x , d+7.32*y  ,outline='black' ,  fill=CC [4] [2] [2])
    F6C4=fond.create_polygon(c+15.32*x , d+5.66*y ,  c+13.66*x , d+5*y ,     c+13.66*x , d+2.66*y , c+15.32*x , d+3.33*y  ,outline='black' ,  fill=CC [4] [1] [0])
    F6C5=fond.create_polygon(c+15.32*x , d+8*y ,     c+13.66*x , d+7.32*y ,  c+13.66*x , d+5*y ,    c+15.32*x , d+5.66*y  ,outline='black' ,  fill=CC [4] [1] [1])  
    F6C6=fond.create_polygon(c+15.32*x , d+10.33*y , c+13.66*x , d+9.66*y ,  c+13.66*x , d+7.32*y , c+15.32*x , d+8*y     ,outline='black' ,  fill=CC [4] [1] [2])
    F6C7=fond.create_polygon(c+17*x ,    d+6.33*y ,  c+15.32*x , d+5.66*y ,  c+15.32*x , d+3.33*y , c+17*x ,    d+4*y     ,outline='black' ,  fill=CC [4] [0] [0])
    F6C8=fond.create_polygon(c+17*x ,    d+8.66*y ,  c+15.32*x , d+8*y ,     c+15.32*x , d+5.66*y , c+17*x ,    d+6.33*y  ,outline='black' ,  fill=CC [4] [0] [1])
    F6C9=fond.create_polygon(c+17*x ,    d+11*y ,    c+15.32*x , d+10.33*y , c+15.32*x , d+8*y ,    c+17*x ,    d+8.66*y  ,outline='black' ,  fill=CC [4] [0] [2])


    



def Opt_Affichage () :

    if ag == 0 :
        AfficheGraphique ()
    elif ag == 1 :
        AfficheGraphique3D ()


def Mvt1():
    global CC,cm1
    cm1=[[[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]], 
         [[CC[5][2][2],CC[5][2][1],CC[5][2][0]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[2][2][0],CC[2][1][0],CC[2][0][0]],[CC[2][2][1],CC[2][1][1],CC[2][0][1]],[CC[2][2][2],CC[2][1][2],CC[2][0][2]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
         [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[0][0][2],CC[0][0][1],CC[0][0][0]]]]

    CC=cm1

    Opt_Affichage ()
    


def Mvt2():
    global CC,cm2
    
    cm2=[[[CC[5][2][0],CC[5][2][1],CC[5][2][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
         [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[2][0][2],CC[2][1][2],CC[2][2][2]],[CC[2][0][1],CC[2][1][1],CC[2][2][1]],[CC[2][0][0],CC[2][1][0],CC[2][2][0]]],
         [[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[4][2][0],CC[4][1][0],CC[4][0][0]],[CC[4][2][1],CC[4][1][1],CC[4][0][1]],[CC[4][2][2],CC[4][1][2],CC[4][0][2]]],
         [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[1][0][0],CC[1][0][1],CC[1][0][2]]]]
    CC=cm2

    Opt_Affichage ()
        

def Mvt3():
    global CC,cm3
    cm3=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[5][1][2],CC[5][1][1],CC[5][1][0]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
         [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
         [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[0][1][2],CC[0][1][1],CC[0][1][0]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm3

    Opt_Affichage ()
        


def Mvt4():
    global CC,cm4

    cm4=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]], 
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
         [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
         [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm4

    Opt_Affichage ()
        


def Mvt5 ():
    global CC ,cm5
    cm5=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[5][0][2],CC[5][0][1],CC[5][0][0]]],
         [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
         [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[4][0][2],CC[4][1][2],CC[4][2][2]],[CC[4][0][1],CC[4][1][1],CC[4][2][1]],[CC[4][0][0],CC[4][1][0],CC[4][2][0]]],
         [[CC[0][2][2],CC[0][2][1],CC[0][2][0]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm5

    Opt_Affichage ()
        


def Mvt6():
   global CC,cm6
   cm6=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[5][0][2],CC[5][0][1],CC[5][0][0]]],
        [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
        [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
        [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
        [[CC[4][2][0],CC[4][1][0],CC[4][0][0]],[CC[4][2][1],CC[4][1][1],CC[4][0][1]],[CC[4][2][2],CC[4][1][2],CC[4][0][2]]],
        [[CC[1][2][2],CC[1][2][1],CC[1][2][0]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
   CC=cm6

   Opt_Affichage ()
    

def Mvt7():
    global CC ,cm7
    cm7=[[[CC[0][0][2],CC[0][1][2],CC[0][2][2]],[CC[0][0][1],CC[0][1][1],CC[0][2][1]],[CC[0][0][0],CC[0][1][0],CC[0][2][0]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[3][0][0],CC[2][0][1],CC[2][0][2]],[CC[3][1][0],CC[2][1][1],CC[2][1][2]],[CC[3][2][0],CC[2][2][1],CC[2][2][2]]],
         [[CC[4][0][0],CC[3][0][1],CC[3][0][2]],[CC[4][1][0],CC[3][1][1],CC[3][1][2]],[CC[4][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[5][0][0],CC[4][0][1],CC[4][0][2]],[CC[5][1][0],CC[4][1][1],CC[4][1][2]],[CC[5][2][0],CC[4][2][1],CC[4][2][2]]],
         [[CC[2][0][0],CC[5][0][1],CC[5][0][2]],[CC[2][1][0],CC[5][1][1],CC[5][1][2]],[CC[2][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm7

    Opt_Affichage ()



def Mvt8():
    global CC ,cm8
    cm8=[[[CC[0][2][0],CC[0][1][0],CC[0][0][0]],[CC[0][2][1],CC[0][1][1],CC[0][0][1]],[CC[0][2][2],CC[0][1][2],CC[0][0][2]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[5][0][0],CC[2][0][1],CC[2][0][2]],[CC[5][1][0],CC[2][1][1],CC[2][1][2]],[CC[5][2][0],CC[2][2][1],CC[2][2][2]]],
         [[CC[2][0][0],CC[3][0][1],CC[3][0][2]],[CC[2][1][0],CC[3][1][1],CC[3][1][2]],[CC[2][2][0],CC[3][2][1],CC[3][2][2]]],
         [[CC[3][0][0],CC[4][0][1],CC[4][0][2]],[CC[3][1][0],CC[4][1][1],CC[4][1][2]],[CC[3][2][0],CC[4][2][1],CC[4][2][2]]],
         [[CC[4][0][0],CC[5][0][1],CC[5][0][2]],[CC[4][1][0],CC[5][1][1],CC[5][1][2]],[CC[4][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm8

    Opt_Affichage ()
        

 
def Mvt9():
    global CC ,cm9
    cm9=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
         [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
         [[CC[2][0][0],CC[3][0][1],CC[2][0][2]],[CC[2][1][0],CC[3][1][1],CC[2][1][2]],[CC[2][2][0],CC[3][2][1],CC[2][2][2]]],
         [[CC[3][0][0],CC[4][0][1],CC[3][0][2]],[CC[3][1][0],CC[4][1][1],CC[3][1][2]],[CC[3][2][0],CC[4][2][1],CC[3][2][2]]],
         [[CC[4][0][0],CC[5][0][1],CC[4][0][2]],[CC[4][1][0],CC[5][1][1],CC[4][1][2]],[CC[4][2][0],CC[5][2][1],CC[4][2][2]]],
         [[CC[5][0][0],CC[2][0][1],CC[5][0][2]],[CC[5][1][0],CC[2][1][1],CC[5][1][2]],[CC[5][2][0],CC[2][2][1],CC[5][2][2]]]]
    CC=cm9

    Opt_Affichage ()
        


def Mvt10():
    global CC ,cm10
    cm10=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
          [[CC[1][0][0],CC[1][0][1],CC[1][0][2]],[CC[1][1][0],CC[1][1][1],CC[1][1][2]],[CC[1][2][0],CC[1][2][1],CC[1][2][2]]],
          [[CC[2][0][0],CC[5][0][1],CC[2][0][2]],[CC[2][1][0],CC[5][1][1],CC[2][1][2]],[CC[2][2][0],CC[5][2][1],CC[2][2][2]]],
          [[CC[3][0][0],CC[2][0][1],CC[3][0][2]],[CC[3][1][0],CC[2][1][1],CC[3][1][2]],[CC[3][2][0],CC[2][2][1],CC[3][2][2]]],
          [[CC[4][0][0],CC[3][0][1],CC[4][0][2]],[CC[4][1][0],CC[3][1][1],CC[4][1][2]],[CC[4][2][0],CC[3][2][1],CC[4][2][2]]],
          [[CC[5][0][0],CC[4][0][1],CC[5][0][2]],[CC[5][1][0],CC[4][1][1],CC[5][1][2]],[CC[5][2][0],CC[4][2][1],CC[5][2][2]]]]
    CC=cm10

    Opt_Affichage ()
    


def Mvt11():
    global CC ,cm11
    cm11=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
          [[CC[1][2][0],CC[1][1][0],CC[1][0][0]],[CC[1][2][1],CC[1][1][1],CC[1][0][1]],[CC[1][2][2],CC[1][1][2],CC[1][0][2]]],
          [[CC[2][0][0],CC[2][0][1],CC[3][0][2]],[CC[2][1][0],CC[2][1][1],CC[3][1][2]],[CC[2][2][0],CC[2][2][1],CC[3][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[4][0][2]],[CC[3][1][0],CC[3][1][1],CC[4][1][2]],[CC[3][2][0],CC[3][2][1],CC[4][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[5][0][2]],[CC[4][1][0],CC[4][1][1],CC[5][1][2]],[CC[4][2][0],CC[4][2][1],CC[5][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[2][0][2]],[CC[5][1][0],CC[5][1][1],CC[2][1][2]],[CC[5][2][0],CC[5][2][1],CC[2][2][2]]]]
    CC=cm11

    Opt_Affichage ()
      


def Mvt12():
    global CC ,cm12
    cm12=[[[CC[0][0][0],CC[0][0][1],CC[0][0][2]],[CC[0][1][0],CC[0][1][1],CC[0][1][2]],[CC[0][2][0],CC[0][2][1],CC[0][2][2]]],
          [[CC[1][0][2],CC[1][1][2],CC[1][2][2]],[CC[1][0][1],CC[1][1][1],CC[1][2][1]],[CC[1][0][0],CC[1][1][0],CC[1][2][0]]],
          [[CC[2][0][0],CC[2][0][1],CC[5][0][2]],[CC[2][1][0],CC[2][1][1],CC[5][1][2]],[CC[2][2][0],CC[2][2][1],CC[5][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[2][0][2]],[CC[3][1][0],CC[3][1][1],CC[2][1][2]],[CC[3][2][0],CC[3][2][1],CC[2][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[3][0][2]],[CC[4][1][0],CC[4][1][1],CC[3][1][2]],[CC[4][2][0],CC[4][2][1],CC[3][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[4][0][2]],[CC[5][1][0],CC[5][1][1],CC[4][1][2]],[CC[5][2][0],CC[5][2][1],CC[4][2][2]]]]
    CC=cm12

    Opt_Affichage ()
     

def Mvt13():
    global CC,cm13
    cm13=[[[CC[4][2][0],CC[0][0][1],CC[0][0][2]],[CC[4][2][1],CC[0][1][1],CC[0][1][2]],[CC[4][2][2],CC[0][2][1],CC[0][2][2]]],
          [[CC[1][0][0],CC[1][0][1],CC[2][0][0]],[CC[1][1][0],CC[1][1][1],CC[2][0][1]],[CC[1][2][0],CC[1][2][1],CC[2][0][2]]],
          [[CC[0][2][0],CC[0][1][0],CC[0][0][0]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[1][2][2],CC[1][1][2],CC[1][0][2]]],
          [[CC[5][0][2],CC[5][1][2],CC[5][2][2]],[CC[5][0][1],CC[5][1][1],CC[5][2][1]],[CC[5][0][0],CC[5][1][0],CC[5][2][0]]]]
    CC=cm13

    Opt_Affichage ()     
        
def Mvt14():
    global CC,cm14
    cm14=[[[CC[2][0][2],CC[0][0][1],CC[0][0][2]],[CC[2][0][1],CC[0][1][1],CC[0][1][2]],[CC[2][0][0],CC[0][2][1],CC[0][2][2]]],
          [[CC[1][0][0],CC[1][0][1],CC[4][2][2]],[CC[1][1][0],CC[1][1][1],CC[4][2][1]],[CC[1][2][0],CC[1][2][1],CC[4][2][0]]],
          [[CC[1][0][2],CC[1][1][2],CC[1][2][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[0][0][0],CC[0][1][0],CC[0][2][0]]],
          [[CC[5][2][0],CC[5][1][0],CC[5][0][0]],[CC[5][2][1],CC[5][1][1],CC[5][0][1]],[CC[5][2][2],CC[5][1][2],CC[5][0][2]]]]
    CC=cm14

    Opt_Affichage ()
  
        
def Mvt15():
    global CC,cm15
    cm15=[[[CC[0][0][0],CC[4][1][0],CC[0][0][2]],[CC[0][1][0],CC[4][1][1],CC[0][1][2]],[CC[0][2][0],CC[4][1][2],CC[0][2][2]]],
          [[CC[1][0][0],CC[2][1][0],CC[1][0][2]],[CC[1][1][0],CC[2][1][1],CC[1][1][2]],[CC[1][2][0],CC[2][1][2],CC[1][2][2]]],
          [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[0][2][1],CC[0][1][1],CC[0][0][1]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[1][2][1],CC[1][1][1],CC[1][0][1]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm15

    Opt_Affichage ()    
        

def Mvt16():
    global CC,cm16
    cm16=[[[CC[0][0][0],CC[2][1][2],CC[0][0][2]],[CC[0][1][0],CC[2][1][1],CC[0][1][2]],[CC[0][2][0],CC[2][1][0],CC[0][2][2]]],
          [[CC[1][0][0],CC[4][1][2],CC[1][0][2]],[CC[1][1][0],CC[4][1][1],CC[1][1][2]],[CC[1][2][0],CC[4][1][0],CC[1][2][2]]],
          [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[1][0][1],CC[1][1][1],CC[1][2][1]],[CC[2][2][0],CC[2][2][1],CC[2][2][2]]],
          [[CC[3][0][0],CC[3][0][1],CC[3][0][2]],[CC[3][1][0],CC[3][1][1],CC[3][1][2]],[CC[3][2][0],CC[3][2][1],CC[3][2][2]]],
          [[CC[4][0][0],CC[4][0][1],CC[4][0][2]],[CC[0][0][1],CC[0][1][1],CC[0][2][1]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm16

    Opt_Affichage ()
    

def Mvt17():
    global CC,cm17
    cm17=[[[CC[0][0][0],CC[0][0][1],CC[4][0][0]],[CC[0][1][0],CC[0][1][1],CC[4][0][1]],[CC[0][2][0],CC[0][2][1],CC[4][0][2]]],
          [[CC[2][2][0],CC[1][0][1],CC[1][0][2]],[CC[2][2][1],CC[1][1][1],CC[1][1][2]],[CC[2][2][2],CC[1][2][1],CC[1][2][2]]],
          [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[0][2][2],CC[0][1][2],CC[0][0][2]]],
          [[CC[3][2][0],CC[3][1][0],CC[3][0][0]],[CC[3][2][1],CC[3][1][1],CC[3][0][1]],[CC[3][2][2],CC[3][1][2],CC[3][0][2]]],
          [[CC[1][2][0],CC[1][1][0],CC[1][0][0]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm17

    Opt_Affichage ()


def Mvt18():
    global CC,cm18
    cm18=[[[CC[0][0][0],CC[0][0][1],CC[2][2][2]],[CC[0][1][0],CC[0][1][1],CC[2][2][1]],[CC[0][2][0],CC[0][2][1],CC[2][2][0]]],
          [[CC[4][0][2],CC[1][0][1],CC[1][0][2]],[CC[4][0][1],CC[1][1][1],CC[1][1][2]],[CC[4][0][0],CC[1][2][1],CC[1][2][2]]],
          [[CC[2][0][0],CC[2][0][1],CC[2][0][2]],[CC[2][1][0],CC[2][1][1],CC[2][1][2]],[CC[1][0][0],CC[1][1][0],CC[1][2][0]]],
          [[CC[3][0][2],CC[3][1][2],CC[3][2][2]],[CC[3][0][1],CC[3][1][1],CC[3][2][1]],[CC[3][0][0],CC[3][1][0],CC[3][2][0]]],
          [[CC[0][0][2],CC[0][1][2],CC[0][2][2]],[CC[4][1][0],CC[4][1][1],CC[4][1][2]],[CC[4][2][0],CC[4][2][1],CC[4][2][2]]],
          [[CC[5][0][0],CC[5][0][1],CC[5][0][2]],[CC[5][1][0],CC[5][1][1],CC[5][1][2]],[CC[5][2][0],CC[5][2][1],CC[5][2][2]]]]
    CC=cm18

    Opt_Affichage ()
    



def Boutons():
     
    Bmvt1 = Button(fenetre, text="Mvt1", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt1 , image = photo)
    Bmvt1_fenetre = fond.create_window(x+260, y-10, window=Bmvt1)

    Bmvt2 = Button(fenetre, text="Mvt2", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt2 , image = photo2)
    Bmvt2_fenetre = fond.create_window(x+260, 700, window=Bmvt2)

    Bmvt3 = Button(fenetre, text="Mvt3", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt3 , image = photo)
    Bmvt3_fenetre = fond.create_window(x+325, y-10, window=Bmvt3)
    
    Bmvt4 = Button(fenetre, text="Mvt4", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt4 , image = photo2)
    Bmvt4_fenetre = fond.create_window(x+325, 700, window=Bmvt4)

    Bmvt5 = Button(fenetre, text="Mvt5", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt5 , image = photo)
    Bmvt5_fenetre = fond.create_window(x+390, y-10 , window=Bmvt5)
    
    Bmvt6 = Button(fenetre, text="Mvt6", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt6 , image = photo2)
    Bmvt6_fenetre = fond.create_window(x+390, 700 , window=Bmvt6)

    Bmvt7 = Button(fenetre, text="Mvt7", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt7 , image = photo3)
    Bmvt7_fenetre = fond.create_window(x-5, 300, window=Bmvt7)

    Bmvt8 = Button(fenetre, text="Mvt8", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt8 , image = photo1)
    Bmvt8_fenetre = fond.create_window(x+860, 300 , window=Bmvt8)

    Bmvt9 = Button(fenetre, text="Mvt9", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt9 , image = photo3)
    Bmvt9_fenetre = fond.create_window(x-5, 360, window=Bmvt9)

    Bmvt10 = Button(fenetre, text="Mvt10", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt10 , image = photo1)
    Bmvt10_fenetre = fond.create_window(x+860, 360, window=Bmvt10)

    Bmvt11 = Button(fenetre, text="Mvt11", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt11 , image = photo3)
    Bmvt11_fenetre = fond.create_window(x-5, 420, window=Bmvt11)

    Bmvt12 = Button(fenetre, text="Mvt12", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt12 , image = photo1)
    Bmvt12_fenetre = fond.create_window(x+860 , 420, window=Bmvt12)

    Bmvt13 = Button(fenetre, text="Mvt13", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt13 , image = photo1)
    Bmvt13_fenetre = fond.create_window(x+470 , 625, window=Bmvt13)

    Bmvt14 = Button(fenetre, text="Mvt14", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt14 , image = photo3)
    Bmvt14_fenetre = fond.create_window(x+180, 625, window=Bmvt14)

    Bmvt15 = Button(fenetre, text="Mvt15", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt15 , image = photo1)
    Bmvt15_fenetre = fond.create_window(x+470 , 560, window=Bmvt15)

    Bmvt16 = Button(fenetre, text="Mvt16", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt16 , image = photo3)
    Bmvt16_fenetre = fond.create_window(x+180 , 560, window=Bmvt16)

    Bmvt17 = Button(fenetre, text="Mvt17", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt17 , image = photo1)
    Bmvt17_fenetre = fond.create_window(x+470 , 500, window=Bmvt17)

    Bmvt18 = Button(fenetre, text="Mvt18", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt18 , image = photo3)
    Bmvt18_fenetre = fond.create_window(x+180 , 500, window=Bmvt18) 


def Boutons_3D():
     
    Bmvt1 = Button(fenetre, text="Mvt1", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt1 , image = photo)
    Bmvt1_fenetre = fond.create_window(3.5*x, 105, window=Bmvt1)

    Bmvt2 = Button(fenetre, text="Mvt2", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt2 , image = photo2)
    Bmvt2_fenetre = fond.create_window(23.25*x, 430, window=Bmvt2)

    Bmvt3 = Button(fenetre, text="Mvt3", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt3 , image = photo)
    Bmvt3_fenetre = fond.create_window(5.25*x, 80, window=Bmvt3)
    
    Bmvt4 = Button(fenetre, text="Mvt4", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt4 , image = photo2)
    Bmvt4_fenetre = fond.create_window(21.5*x, 455, window=Bmvt4)

    Bmvt5 = Button(fenetre, text="Mvt5", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt5 , image = photo)
    Bmvt5_fenetre = fond.create_window(7*x, 55 , window=Bmvt5)
    
    Bmvt6 = Button(fenetre, text="Mvt6", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt6 , image = photo2)
    Bmvt6_fenetre = fond.create_window(20*x, 475 , window=Bmvt6)

    Bmvt7 = Button(fenetre, text="Mvt7", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt7 , image = photo3)
    Bmvt7_fenetre = fond.create_window(2*x, 180, window=Bmvt7)

    Bmvt8 = Button(fenetre, text="Mvt8", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt8 , image = photo1)
    Bmvt8_fenetre = fond.create_window(25*x, 180 , window=Bmvt8)

    Bmvt9 = Button(fenetre, text="Mvt9", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt9 , image = photo3)
    Bmvt9_fenetre = fond.create_window(2*x, 265, window=Bmvt9)

    Bmvt10 = Button(fenetre, text="Mvt10", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt10 , image = photo1)
    Bmvt10_fenetre = fond.create_window(25*x, 265, window=Bmvt10)

    Bmvt11 = Button(fenetre, text="Mvt11", bg= 'red' , font= "Helvetica 12 bold" , command=Mvt11 , image = photo3)
    Bmvt11_fenetre = fond.create_window(2*x, 350, window=Bmvt11)

    Bmvt12 = Button(fenetre, text="Mvt12", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt12 , image = photo1)
    Bmvt12_fenetre = fond.create_window(25*x , 350, window=Bmvt12)

    Bmvt13 = Button(fenetre, text="Mvt13", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt13 , image = photo2)
    Bmvt13_fenetre = fond.create_window(3.5*x , 460, window=Bmvt13)

    Bmvt14 = Button(fenetre, text="Mvt14", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt14 , image = photo)
    Bmvt14_fenetre = fond.create_window(20*x, 65 , window=Bmvt14)

    Bmvt15 = Button(fenetre, text="Mvt15", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt15 , image = photo2)
    Bmvt15_fenetre = fond.create_window(5.25*x , 480, window=Bmvt15)

    Bmvt16 = Button(fenetre, text="Mvt16", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt16 , image = photo)
    Bmvt16_fenetre = fond.create_window(21.5*x , 85, window=Bmvt16)

    Bmvt17 = Button(fenetre, text="Mvt17", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt17 , image = photo2)
    Bmvt17_fenetre = fond.create_window(7*x , 500, window=Bmvt17)

    Bmvt18 = Button(fenetre, text="Mvt18", bg= 'red', font= "Helvetica 12 bold"  , command=Mvt18 , image = photo)
    Bmvt18_fenetre = fond.create_window(23.25*x , 108, window=Bmvt18) 

        

photo = PhotoImage(file='arrow1.png')
photo1 = PhotoImage(file='arrowdroite.png')
photo2 = PhotoImage(file='arrowbas.png')
photo3 = PhotoImage(file='arrowgauche.png')



fermer = Button(fenetre, text="Exit", bg='SlateGray1' , bd= 10 , activebackground ='red',command=fenetre.destroy)
fermer_fenetre = fond.create_window(40, 20, window=fermer)


phrase = Label(fond, text="Rubik's Cube", fg='black' , bg ='#E4E4E4' , font= "Helvetica 36 bold")
phrase.pack()
fond.create_window(700, 590, window=phrase)



if ag == 0 :
        AfficheGraphique (),Boutons()
elif ag == 1 :
        AfficheGraphique3D (),Boutons_3D()


fenetre.mainloop()

** Download these files - Files

Comments

Popular posts from this blog

How to create a login page in Tkinter [PYTHON] {VS CODE}

if You want to create a login page in tkinter here's the  tutorial   Insure that you have installed Tkinter Module VIDEO: Source code: from tkinter import * root = Tk() root.geometry( "700x455" ) def k():     Label(text= "Login UnSuccesful" ,font= "timesnewroman 12 bold" ).grid(row= 12 ,column= 3 ) i = Label(text= "User ID" ,font= "comicsansm 15 bold" ).grid(row= 2 ,column= 2 ) j = Label(text= "Password" ,font= "comicsansm 15 bold" ).grid(row= 3 ,column= 2 ) Label(text= "LOGIN SETUP" ,font= "callebri 13 bold" ,padx= 540 ).grid(row= 0 ,column= 3 ,columnspan= 9 ) user = Entry(textvariable=i).grid(row= 2 ,column= 3 ) passwd = Entry(textvariable=j).grid(row= 3 ,column= 3 ) Button(text= "SUBMIT" ,command=k,font= "helvatica 10 bold" ).grid(row = 6 , column= 3 ) root.mainloop()

How to declare a variable in python? Variable in python|

Welcome back to the course of Python. In previous blog we knew how to print anything in python. In this blog we are going to talk about Variable  in python. What is variable in python?  Variables are like storehouse of the data we want to use for our program. When we add some value in a variable python saves it and it can be use in program. Now the question is how we store anything in variable? The answer is very simple firts we call a variable name and then give some value to them. for example a = "Python" b = 120 And so on Python have 5 types of variable. String Number List Tuple Dictionary But for now we are just going to focus on Numbers and string. Here's a video how to declare a variable in python. Follow me for full course and follow me on Instagram and ask questions  Instagram -  https://instagram.com/praphull_verma12?igshid=1uyrn4ksip94l Give your suggestions in comment box.........