Reputation: 17
How do I create a new tkinter root window on top of the main root window that prevents you from accessing the main window until you close the secondary window?
Here is the code that I've written so far (in python 3.6):
from tkinter import *
root = Tk()
root.geometry('600x400+0+0')
def new_page():
rootB = Tk()
btnNP = Button(root, padx=1, pady=2, fg='black',relief='raise',font=
('garamond',10, 'italic', 'bold'),
text='New Page', bg='blue', command=new_page)
btnNP.place(x=100, y=300)
text1 = Text(root, bd=5, height=1, width=14, bg='pink')
text1.place(x=100, y=250)
root.mainloop()
Upvotes: 0
Views: 5845
Reputation: 232
I use Toplevel instead of a new root
def New_page():
popup = Toplevel()
popup.grab_set()
this should do the trick
Upvotes: 3