I started looking at some Tkinter tutorials. I always like to mess around with code before going on with the next chapter: for instance I tried to open more than one independent root.
from Tkinter import *
def main():
root1, root2 = Tk(), Tk()
root1.title("First window")
root2.title("Second window")
root1.mainloop()
root2.mainloop()
main()
What I don't understand is why this code works (i.e. it shows two different windows at the same time). If the Tk "mainloop" method is a loop, why do I see the second window? Shouldn't I see it only after closing the first window (i.e. after breaking the first while loop)?
Please, explain me how it works