I'm writing an experimental GUI framework. The GUI is constructed by combining components (similar to widgets). There are a few "native" classes of components. The framework user specializes by providing certain methods that define configuration, bindings, etc. This can be done by extending a native class and overriding its methods, which is fine, but many of the derived classes will be instantiated just once. Alternatively, I could provide a factory function that would take a native class and the specializing methods (functions, really). This function would instantiate the native class and replace the appropriate methods. Any reason to prefer one approach over the other?
What most GUI toolkits (wxpython,kivy,pyQT) in python are doing is the inheritance approach.
I guess both approach should work but using inheritance will be more familiar to your potential users
What you may also want to look at is a template language (suck as kv lang or html)
to layout the UI since it is a modern approach
Monkey patching vs inheritance and overriding in Python