-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make uix widgets accessible with "from kivy.uix import Button..." #4221
Comments
The import syntax would be nice, but requiring all the other widgets to be present is not desired. Duplicate of #3583. |
Worth mentioning that Factory provides easy import if you need it; from kivy.factory import Factory
lbl = Factory.Label(text="Hello World")
class MyScatter(Factory.Scatter):
pass |
Maybe that's the way how init could work? Import in init Factory and for each widget return |
It probably would be possible to use an import hook method, though this has the disadvantage of possibly breaking the code detection of some IDEs. Is the reason for not doing this entirely performance? If so, it would be possible (though a little untidy) to have a kivy.uix.everything module providing all the imports. |
Not really performance, just making it less to write. Sometimes it reminds me java(e.g. writing the same words multiple times). It doesn't look like that if the words are short, but when you import for example screenmanager, the imports can be long. |
I'm referring to the reason not to have this type of import - if all the widgets are imported by |
It seems almost trivial, but would it be possible to make some of the more commonly used/base widgets accessible in the
kivy/uix/__init__.py
module?This would mean instead of needing to do the following:
You only need to do the following:
The reason for this request is mainly to help tidy up the imports a little and means it isn't necessary to write a 30 almost identical lines when wanting to import 30 different widgets.
As far as I can tell, you would just need to import the desired classes into the
kivy/uix/__init__.py
module and adjust the__all__
variable like so:The text was updated successfully, but these errors were encountered: