How to make 3'rd party widgets using Native code? #2927
-
For simplicity as a fist implementation lets say I want to create a widget called mybox for android and gtk by simply copying their respective box.py to mybox.by What would I need to modify? Class name from Box to MyBox in each files. what else? How would I structure / package that? Can I leverage the factory in place? in the source I see a factory.py inside toga_gtk and inside toga_android folders that point to the Box classes I'm not trying to fork toga and add mybox.py to its source. Is there a clean way to package that as a third party? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Right now, there isn't a built-in way to replicate what toga-core is doing around widget registration in a third-party widget. The immediate workaround is to reproduce what toga-core is doing with factory handling in your own code - that is, define a factory function that checks However, longer term, this is something that I'd like to add as a baked-in capability of Toga. I can think I can think of two ways that this could be implemented.
In the best case, Toga would "eat its own dogfood", and use the same mechanisms for built-in widgets that third party widgets use. |
Beta Was this translation helpful? Give feedback.
I've opened #2928 to track the feature request.