I just discovered why some functions doesn’t work properly in my script…
Let me explain…
So, using Tkinter, I created a root window where some function opens in it.
For other functions (to write datas in a csv file), I’ve programmed (inside them) to open a new window to have another one, while the root window is still open. For this last way, it doesn’t write datas into the csv file and IDE won’t print any error because the function is correct and it work properly if isolated from the rest of the program.
But… if I delete from the function the opening of a new window but simply open the function into the root window, it works!
My question is… why?
I would keep the new window for a better GUI clarity, so, is there a way to make the function work with a new window?
A little example would something like that (this doesn’t work):
I suspect your problem is that you’re using Tk() twice to open a new window. You really don’t want to call that twice, it actually basically creates two entirely separate Tkinter systems that don’t know how to talk to each other. What you want to do is use Toplevel instead for your new window, which takes the root window as its parent.
God bless you my friend!!! It was months that I was searching for a solution. I heard something about Toplevel but documentation is strictly technical. So I found a little tutorial and now I solved… I hope:-)) (and first I finally understood what Toplevel is).
As a total newbie with so little time to spend for learning to code is quite difficult follow a regular learning path!
Thanks a lot again!
Sorry, I don’t understand why you said this to me… what I had leaved out from the backticks?
Not sure what you mean, but yes you can put frames inside a toplevel, any widget in general. It behaves the same really as Tk does. It’s actually a good idea to put a ttk.Frame inside your toplevels immediately, because that’ll make it have the correct background colour.