Créé comme une simple soumission d'estimation approximative. Le code bâclé est trop long et sera corrigé à l'avenir. Nous prévoyons de contester la conversion en PDF à l'avenir.
import tkinter as tk
 
def callBackFunc():
    global a
    global a1
    a=str('Produit 1')
    a1=10000000
def callBackFunc1():
    global a,a1
    a=str('Produit 2')
    a1=20000000
def callBackFunc2():
    global a,a1
    a=str('Produit 3')
    a1=8000000
def callBackFunc3():
    global b,b1
    b=str('2 longueurs d'onde')
    b1=5000000
def callBackFunc4():
    global b,b1
    b=str('3 longueurs d'onde')
    b1=6500000
def callBackFunc5():
    global b,b1
    b=str('4 longueurs d'onde')
    b1=7500000
app = tk.Tk() 
app.geometry('300x200')
#-------------Écran CSU------------
#Créer 2 cases à cocher
chkValue = tk.BooleanVar() 
chkValue.set(False)
chkValue1 = tk.BooleanVar() 
chkValue1.set(False)
chkValue2 = tk.BooleanVar() 
chkValue2.set(False)
#3 cases à cocher texte
chkExample = tk.Checkbutton(app, text='CSUW1', 
                            var=chkValue, command=callBackFunc) 
chkExample1 = tk.Checkbutton(app, text='CSUW1SoRa', 
                            var=chkValue1, command=callBackFunc1)
chkExample2 = tk.Checkbutton(app, text='CSUX1', 
                            var=chkValue2, command=callBackFunc2)
#Cochez 2 cases
chkExample.place(x=30, y=30)
chkExample1.place(x=30, y=50)
chkExample2.place(x=30, y=70)
frame1=tk.Frame()
frame1.place(x=30,y=100)
#Bouton pour revenir de l'image 1 à l'image principale
back_button = tk.Button(frame1, text="laser", command=changePage)
back_button.pack()
#----------Écran laser----------------------
def changePage():
    frame2=tk.Frame()
    frame2.place(x=30,y=100)
    back_button = tk.Button(frame2, text="Estimations", command=changePage1)
    back_button.pack()
#Créer 2 cases à cocher
    chkValue3 = tk.BooleanVar() 
    chkValue3.set(False)
    chkValue4 = tk.BooleanVar() 
    chkValue4.set(False)
    chkValue5 = tk.BooleanVar() 
    chkValue5.set(False)
#3 cases à cocher texte
    chkExample3 = tk.Checkbutton(app, text='2 longueurs d'onde', 
                            var=chkValue3, command=callBackFunc3) 
    chkExample4 = tk.Checkbutton(app, text='3 longueurs d'onde', 
                            var=chkValue4, command=callBackFunc4)
    chkExample5 = tk.Checkbutton(app, text='4 longueurs d'onde', 
                            var=chkValue5, command=callBackFunc5)
#Cochez 2 cases
    chkExample3.place(x=30, y=30)
    chkExample4.place(x=30, y=50)
    chkExample5.place(x=30, y=70)
#-----------Écran d'estimation---------------------
def changePage1():
        app1 = tk.Tk() 
        app1.geometry('500x300')
        app1.title('Estimation approximative')
        lbl=tk.Label(app1,text='Estimation approximative')
        lbl.place(x=30,y=50)
        txt=tk.Entry(app1,width=20)
        txt.place(x=30,y=80)
        lbl1=tk.Label(app1,text='m')
        lbl1.place(x=180,y=80)
        lbl2=tk.Label(app1,text='nom du produit')
        lbl2.place(x=30,y=120)
        lbl5=tk.Label(app1,text=str(a))
        lbl5.place(x=30,y=180)
        lbl8=tk.Label(app1,text=str(b))
        lbl8.place(x=30,y=210)
        lbl3=tk.Label(app1,text='Liste des prix')
        lbl3.place(x=250,y=120)
        lbl6=tk.Label(app1,text=str(a1))
        lbl6.place(x=250,y=180)
        lbl9=tk.Label(app1,text=str(b1))
        lbl9.place(x=250,y=210)
        lbl4=tk.Label(app1,text='Cloison')
        lbl4.place(x=400,y=120)
        lbl7=tk.Label(app1,text=str(int(a1)*0.8))
        lbl7.place(x=400,y=180)
        lbl10=tk.Label(app1,text=str(int(b1)*0.8))
        lbl10.place(x=400,y=210)
        lbl11=tk.Label(app1,text='total')
        lbl11.place(x=200,y=240)
        lbl12=tk.Label(app1,text=str(int(a1)+int(b1)))
        lbl12.place(x=250,y=240)
        lbl13=tk.Label(app1,text=str(int(a1)*0.8+int(b1)*0.8))
        lbl13.place(x=400,y=240)
        back_button = tk.Button(app1, text="PDF")
        back_button.pack()
app.mainloop()
Recommended Posts