I did a class for make custom message boxes in phyton but I not sure if it is the correct way. Is to let user choose over three or four choices with a command call back using string formatting. I want to know can make run by a function passed in the constructor as text or are easier ways. Many thanks in advance.
def __init__(self, parent, *titlesAndQuestion, **buttonText):
self.parent=parent
ScreenWidth = self.parent.winfo_screenwidth()
ScreenHeight = self.parent.winfo_screenheight()
# check window size to make root size
rootSizerWidth= int(ScreenWidth*0.25)
rootSizerHeight= int(ScreenHeight*0.25)
topLeftPosition=(int((ScreenWidth- rootSizerWidth)/2),int((ScreenHeight- rootSizerHeight)/2))
top=Toplevel(self.parent)
top.geometry(f'{rootSizerWidth}x{rootSizerHeight}+{topLeftPosition[0]}+{topLeftPosition[1]}')
top.transient(self.parent)
top.tittle(titlesAndQuestion[0])
top.frame=Frame(top)
top.label=Label(frame, text=titlesAndQuestion[1]).pack(pady=(SreemWidth/200))
frame.pack(pady=(SreemWidth/200))
top.grab_set()
top.frameButton=Frame(top)
for key, value in buttonText.items():
text=f" ,{"{}='{}'".format(key,value)}"
key=Button(f'{top.frameButton} {text:}')
key.pack(side=LEFT)
top.frameButton.pack()