Sep-10-2019, 02:36 PM
Hello.
I've made two little script with tkinter.
In the first one, you have to enter an animal e.g. "dog" and the word dog, get's written into a textile called "new animals.txt".
Now in the second one, you have to enter an animal too. At this point, I have to problems: (Because I never did that before, and I don't know how to do it):
1. After you've entered the animal in the second script, you're clicking on a button. Now the animal get's written into a text file called "animals.txt". But I want the program to check, if the animal, also stands in "new animals.txt". If it is the case, it get's written into "animals.txt". If the animal, you've entered is not already in "newanimals.txt" not.
2. I've noticed, that if you enter an animal, e.g. dog and after that e.g. cat, the dog gets deleted and the cat is in the first line. How do I do it, that the cat, get's written into the second line, and the dog says in the first line?
Here's the part of my code, you need:
Thanks for your help.
Piethon
I've made two little script with tkinter.
In the first one, you have to enter an animal e.g. "dog" and the word dog, get's written into a textile called "new animals.txt".
Now in the second one, you have to enter an animal too. At this point, I have to problems: (Because I never did that before, and I don't know how to do it):
1. After you've entered the animal in the second script, you're clicking on a button. Now the animal get's written into a text file called "animals.txt". But I want the program to check, if the animal, also stands in "new animals.txt". If it is the case, it get's written into "animals.txt". If the animal, you've entered is not already in "newanimals.txt" not.
2. I've noticed, that if you enter an animal, e.g. dog and after that e.g. cat, the dog gets deleted and the cat is in the first line. How do I do it, that the cat, get's written into the second line, and the dog says in the first line?
Here's the part of my code, you need:
Animalcheck = StringVar() Entry(window, textvariable=Animalcheck).grid(row=4, column=4) ConfirmButton = Button(window, text="Confirm", command=animalcheck).grid(row=6, column=4) def animalcheck(): animalcheck = Animalcheck.get() saveanimal = open("animals.txt", "w") saveanimal.write(animalcheck)That was an example of the second script. The first script looks like it, with a few changes in the document names.
Thanks for your help.
Piethon