有没有可能做一个带有复选框的Tkinter yes/no消息框,比如“永不再问我”?
或者我必须创建另一个窗口,创建我自己的Label
和CheckButton
,然后基本上创建我自己的对话框?
发布于 2021-10-20 00:49:57
然后,您应该创建自己的对话框。
下面是你可以做的:
from tkinter import *
def popup():
popupWin = Toplevel()
popupWin.title(“Continue?”)
checkVariable = IntVar()
lbl = Label(popupWin, text=“Continue?)
lbl.pack()
btn2 = Button(popupWin, text=“Yes”)
btn2.pack()
btn3 = Button(popupWin, text=“No”)
btn3.pack()
checkBox = Checkbutton(popupWin, text=“Don’t ask again”, variable=checkVariable)
root = Tk()
btn = Button(root, text=Message Box, command=popup)
root.mainloop()
https://stackoverflow.com/questions/69559208
复制相似问题