-
Notifications
You must be signed in to change notification settings - Fork 12
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
Added acceptance of string anchors/sides for TkInter such as "w" and "top" #158
base: master
Are you sure you want to change the base?
Conversation
This was actually intentional. Hard-coding string keywords is bad style, and I was hoping to discourage it. (I also suspect it might be deprecated in a version or two, seeing as PEP 435 has been accepted.) For the same reason, I suspect some of the other tk tests might require My personal preference would be to require the constants, and perhaps to add some static analysis warnings explicitly telling students to use them (by checking for, eg, If @pjritee uses string literals in the lectures, then this should definitely be merged. |
On 21/04/15 15:39, Sean Purdon wrote:
I concur
For above reasons I would hope that this is not happening
|
I just had a student point this out to me today. Peter isn't yet up to teaching GUIs, so we don't need to worry for now. Perhaps the best course of action would be to modify my change to give a more detailed warning message when using "w" and "top", for example "You should use tk.TOP instead of {}"? |
Yeah, that would probably be a good idea. You could even generalise this somewhat (up to you whether it's worth the effort):
|
This reverts commit ae9e0dc.
How do people feel about the messages below? I intend to do similar things in other places.
|
If you do it like that (if/else), then the first one needs to be an error, On 21 April 2015 at 18:54, Tom Manderson [email protected] wrote:
|
That was intentional. Do you think error is the way to go? If so, I defer to the wisdom of the more experienced tutor and will do that in other cases. |
Also, should we modify the expand check in GUI 3 so it only accepts tk.TRUE, or keep letting it accept True and 1? |
Now gives a more detailed error on "w" instead of tk.W, etc (anchors and sides)
Is this okay to be merged? |
TKInter accepts string arguments for anchor and sides, but our tests do not. This fixes our inflexibility so that students can write x.pack(side="left"), which Tk accepts.