![]() ![]()
You can see examples that subclass TopLevel and tkSimpleDialog (tkinter.simpledialog in p圓) at effbot. (providing a sequence for dict_key creates an entry for user input)įrm = tki.Frame(self.top, borderwidth=4, relief="ridge")Ĭaller_wants_an_entry = dict_key is not Noneī_submit = tki.Button(frm, text="Submit")ī_submit = lambda: self.entry_to_dict(dict_key)ī_cancel = tki.Button(frm, text="Cancel") import tkinterĭict_key = (dictionary, key) to associate with user input You can save the following as mbox.py in your_python_folder\Lib\site-packages or in the same folder as your main GUI’s file. ![]() You can avoid the need to pass the parent every time you create an instance of the dialog box by binding the parent to a class attribute (root in this example). That creates an anonymous function that will execute your function call (with args) when the button is pressed. The dictionary
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |