Python : Overriding a method from a third-party module (Tkinter)? Python : Overriding a method from a third-party module (Tkinter)? tkinter tkinter

Python : Overriding a method from a third-party module (Tkinter)?


You could make your own dialog class that inherits from tkSimpleDialog. This way you could override any of the class' core methods. Classic OOP and extension to the rescue.

Check this documentation out for a tutorial: http://effbot.org/tkinterbook/tkinter-dialog-windows.htm

Another one: http://effbot.org/tkinterbook/tkinter-entry-dialogs.htm

You could take a look at tkSimpleDialog.py source to see the available class methods and see which ones you can extend. Quicker way is to do dir(tkSimpleDialog) after you have imported it, to see all its methods, properties and classes.

Always remember, if something is a class, there exists an opportunity to extend it into your own!

All the best.