-
Notifications
You must be signed in to change notification settings - Fork 80
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
Consider an alternative to extending tk classes #38
Comments
That seems nice. Need to find some time to work on this - haven't had much lately! |
Nice. I implemented this for Slider in a test version and it seems pretty cool. I don't have an IDE that offers the auto complete though so can't test that. |
It's just like the Python shell but better (no harder to use) 👍 |
I think this approach runs into problems if you try to apply it to the |
Yeah if you can't make it work for |
The app could have a tk property, and the child classes could access App.tk - so any child accesses the tk via it's parent (container) tk attribute. Just saying, because I might or might not have solved a similar problem myself recently :) Tip: Get your head around the 'is-a' vs 'has-a' relationships, to get stronger architecture. |
I believe I have done this with commit 757beea |
Neat! So we're just waiting for the 0.4 release? I'll test it when I get chance. |
Well, I have various other things that are unfinished and might not work - in particular the |
A suggestion: rather than extend tk classes, would you consider creating new classes where the tk object is exposed as a property, so that only the guizero goodness is exposed to most users, but those who wish to (forgive me) tinker below the surface can still get to the nasty tk stuff?
The tk stuff is messy and most of it isn't useful. Using tab completion to find property and methods you're looking for is really difficult:
For example:
So instead of inheriting
Scale
and runningsuper()__init__()
you create a tkScale
object belonging to the guizeroSlider
object. You would provide guizero alternatives to anything useful within the tk object, such asvalue
andadd_command
as shown. Any methods which need access to the tk object just refer toself.tk
instead ofself
.The result:
Somewhat related to @martinohanlon's #25
The text was updated successfully, but these errors were encountered: