# then the close button will act normallyĮxcept AttributeError: self.returning = NoneĪnd: def mbox(msg, b1='OK', b2='Cancel', frame=True, t=False, entry=False): # remove this function and the call to protocol If t: root.after(int(t*1000), func=self.time_out) # if t is specified: call time_out after t seconds # a trick to activate the window (on windows 7) Root.protocol("WM_DELETE_WINDOW", self.close_mod) # call self.close_mod when the close button is pressed Geom = (root.winfo_width(), root.winfo_height(), xp, yp) Yp = (root.winfo_screenheight() // 2) - (root.winfo_height() // 2) Xp = (root.winfo_screenwidth() // 2) - (root.winfo_width() // 2) # the enter button will trigger the focused button's action Message = tkinter.Label(frm_1, text=self.msg)ītn_1 = tkinter.Button(frm_2, width=8, text=b1)ītn_2 = tkinter.Button(frm_2, width=8, text=b2) If isinstance(b2, tuple): b2, self.b2_return = b2 If isinstance(b1, tuple): b1, self.b1_return = b1 # if b1 or b2 is a tuple unpack into the button text
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |