hello ,
I use Tkinter , at the line : print modelidvar in Interface3() function , it prints "" , nothing , without any error message , can i know why plz , here is all the code :

# -*- coding: cp1252 -*-
# -*- coding: cp1252 -*-
from Tkinter import *
import Tkinter as tk


#import os
import ttk
import MySQLdb;

#####################################################################################

def center(window):

    sw = window.winfo_screenwidth()
    sh = window.winfo_screenheight()
    rw = window.winfo_reqwidth()
    rh = window.winfo_reqheight()
    xc = (sw - rw) / 3
    yc = (sh -rh) / 3
    window.geometry("+%d+%d" % (xc, yc))
    window.deiconify()


##################################################################################



################################################################################




#############################################################################


def revenir():

           interf3.destroy()
           Interface2()           


#############################################################################

def valider():
        modelidvar = modelid_entry.get()
        print modelidvar
        interf2.destroy()
        Interface3()



#############################################################################    


def Interface3() :

    global interf3
    global modelidvar

    interf3 = Tk()    
    interf3.geometry("500x400")
    interf3.title('                            Base de données ')  

    f1 = Frame(interf3, bg="blue",  width=500, height=400)
    f1.pack( fill=X, expand=0)   


    lab5= Label(interf3, text="NumBon" , bg = "blue", fg = "white" )
    lab5.place ( x=26 , y=100)

    lab6= Label(interf3, text="DateBon" , bg = "blue", fg = "white" )
    lab6.place ( x=85 , y=100)

    lab7= Label(interf3, text="Total/Bon" , bg = "blue", fg = "white" )
    lab7.place ( x=400 , y=100)


    print modelidvar




    brevenir = Button(interf3, text = " revenir ", command = revenir)
    brevenir.place( x=12, y=266)

    Quitter = Button(interf3, text = "Quitter" , command = interf3.destroy)
    Quitter.place( x=230, y=350 )

    interf3.after(0,center,interf3)


    interf3.mainloop()


################################################################################

def Interface2() :

    global interf2

    fenetre.destroy()

    interf2 = Tk()    
    interf2.geometry("500x400")
    interf2.title('                            Base de données ')  

    f1 = Frame(interf2, bg="blue",  width=500, height=400)
    f1.pack( fill=X, expand=0)

    lab2 = Label(interf2, text="Veuillez saisir le numero d'Import du Model ( num+année , ex: 122013 )\n et cliquer sur valider " , bg = "blue", fg = "white" )
    lab2.place ( x=80 , y=45 )

    global modelidvar

    modelidvar = StringVar()

    lab3= Label(interf2, text="Référence Model :" , bg = "blue", fg = "white" )
    lab3.place ( x=30 , y=100)

    modelid_entry = ttk.Entry(interf2, width=13, textvariable=modelidvar)
    modelid_entry.place (x = 140 , y = 100 )

    modelidvar = modelid_entry.get()




    bvalider = Button(interf2, text = " Valider ", command = valider)
    bvalider.place( x=250, y=100)        

    #revenir = Button(interf2, text = " revenir ", command = revenir)
    #revenir.place( x=12, y=266)

    Quitter = Button(interf2, text = "Quitter" , command = interf2.destroy)
    Quitter.place( x=230, y=350 )

    interf2.after(0,center,interf2)



    interf2.mainloop()







################################################################################    


 ############################################################################   





#####################################


fenetre=Tk()
fenetre.geometry("500x400")
fenetre.title('                                     ')

f1 = Frame(fenetre, bg="blue",  width=500, height=400)
f1.pack( fill=X, expand=0)

lab1 = Label(fenetre, text="Gestion de ressources informatiques" , bg = "blue", fg = "white" )
lab1.place ( x=152 , y=25 )

failure_max = 3

global uservar
global passvar


uservar = StringVar()
passvar = StringVar()

Label(fenetre, text = "User name:" , bg = "blue", fg = "white" ).place(x = 66, y = 100)
Label(fenetre, text = "Password:" , bg = "blue", fg = "white" ).place(x = 66, y = 125)

entryu = ttk.Entry(fenetre , textvariable=uservar)
entryu.place (x = 180 , y = 100)

entryp = ttk.Entry(fenetre, show='*', textvariable=passvar)
entryp.place (x = 180 , y = 125)




b = Button(fenetre, borderwidth=2, text="Login", width=7, pady=0, command=Interface2)#, image=photo, compound=CENTER)#, state=DISABLED)
b.place(x = 220 , y = 160)

frame21 = Frame(fenetre , bg="blue",    width=40, height=40)
frame21.pack( fill=X, side = BOTTOM)

buttonquit = Button(fenetre, text = "Quitter", command = fenetre.destroy)        
buttonquit.place( x=224 , y=350 )




##################################



##################################

#Display

fenetre.after(0,center,fenetre)
fenetre.mainloop()

Using global variables is clumsy and leads to errors. You should declare modlidvar as global in function valider() to be consistent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.