父窗口打开子窗口打开但如何在python中锁定tkinter的父窗口?

2024-10-02 12:30:26 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的密码。父窗口打开子窗口打开,但在python中,tkinter锁定了如何打开父窗口

from tkinter import *
root = Tk()
root.title('Registration form')
root.geometry("200x200") 
def openaddimage():
    addimage = Toplevel(root)
    addimage.title("Add image/screenshot below")
    addimage.geometry("400x200")


btn2 = Button(root, text='Add Image', width=10, bg='darkblue',
              fg='white', command=openaddimage).place(x=170, y=300)

root.mainloop()```

Tags: fromimportformadd密码titletkinterdef
1条回答
网友
1楼 · 发布于 2024-10-02 12:30:26
from tkinter import *
root = Tk()
root.title('Registration form')
root.geometry("200x200") 
def openaddimage():
    addimage = Toplevel(root)
    addimage.title("Add image/screenshot below")
    addimage.geometry("400x200")
    addimage.grab_set()

btn2 = Button(root, text='Add Image', width=10, bg='darkblue',
              fg='white', command=openaddimage).place(x=170, y=300)

root.mainloop()

相关问题 更多 >

    热门问题