Tkinter and Button command

Golem dvaken at hotmail.com
Thu Sep 13 06:23:33 EDT 2001


Hi
Here's my problem :
I've made a form with a entry and a button
The user type a name in the entry and validate with the button
The button call a function wich create a list of directorie with the name
entered in the entry :

But, when i launch the script, it's execute the command 'command' of the
button but i don't click on it ...( sorry for my english, i'm french ;)

So, why it do this ?
Here my code :


from Tkinter import *

# Definition Fonction
def CrRepDdb(val):
    #Cree l'ensemble des repertoires utiles avec Bdd
    mkdir(val)
    chdir(val)
    mkdir("Source")
    mkdir("Website")
    mkdir("Bdd")
    mkdir("SuiviProd")
    mkdir("ClientCode")


# Creation du root ...
root=Tk()

lab2=Label(root,text="Veuillez entrer le nom du projet :")
lab2.pack()

# La zone de texte ...
zon=Entry(root,bg="azure1",fg="dark red",relief="groove")
zon.pack()
zon.insert(INSERT,"test")

mypa=getcwd()
sla="\\"
mypath=mypa+sla

mybut=Button(root,text="create",command=CrRepDdb(mypath))
mybut.pack()

root.mainloop()

Thkx

Golem





More information about the Python-list mailing list