Tkinter help - Why this behavior ? (py3)

Dodo dodo_do_not_wake_up at yahoo.Fr
Sat Jun 5 09:46:05 EDT 2010


Hi,

let's consider this exemple :

from tkinter import *
from tkinter.ttk import *

class First:
	def __init__(self):
		self.root = Tk()
		B = Button(self.root, command=self.op)
		B.pack()
		
		self.root.mainloop()
		
	def op(self):
		Second(self)
		print("print")
		
		
class Second:
	def __init__(self, parent):
		root = Toplevel(parent.root)
		root.grab_set()
		
		root.mainloop()

		
First()



when I close the second window, the print is NOT executed. It's done 
when I close the first window.
Why do it "freeze" my function?

Dorian



More information about the Python-list mailing list