E. Paine <paineeli...@gmail.com> added the comment:

> Why would negating the font size convert it from points to pixels??

Oh... I apologise: I clearly didn't think this through. It doesn't "convert" in 
any sense, it just negates the font size so 16 points becomes 16 pixels. 
Therefore, it is practically useless (besides, a new font object would not help 
the user a converted value anyway) - I therefore do not wish to proceed this 
this part of the issue (I have removed it from the title and will remove it 
from the PR).

> I also think using [.equal] wouldn't add anything

I disagree and will stand by this one! While the user could easily write it 
themselves, I think it would be helpful to have a convenience method to check 
if two fonts represent the same thing that is displayed to the user. When first 
creating this issue, I didn't want to touch __eq__ for two reasons:
1. I didn't know how much code changing this would break (it is very hard to 
check for code usage of dunder methods - if you know any ways please let me 
know!)
2. Checking to see if the fonts are the same Tk object is also very helpful (in 
other, granted fewer, contexts)

For example, something like this could be used in IDLE so that if the user sets 
their font back to the equivalent of the default ("TkFixedFont"), the value 
isn't kept in the user's local config (similar to how all the other options do).

Therefore, while I would like this somehow added, I agree that adding an 
`equal` method that does not do the same thing as `==` is confusing (you just 
have to look at Java and all the confusion over using `==` on strings - a 
'gotcha' for every new Java learner). However, as I said above, I am reluctant 
to touch __eq__. Any ideas?

----------
title: tkinter: add font neg and equal methods -> tkinter: add font equal 
methods

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41851>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to