Aug-11-2017, 04:12 AM
I apologize for asking another question, but how can I disable text anti-aliasing in tkinter? I have tried padx= and pady= -1 and -2, but neither works. Will I just have to try to install tkinter 8.4?
|
[Tkinter] Disable anti aliasing for text
|
|
Aug-11-2017, 04:12 AM
I apologize for asking another question, but how can I disable text anti-aliasing in tkinter? I have tried padx= and pady= -1 and -2, but neither works. Will I just have to try to install tkinter 8.4?
Aug-11-2017, 05:44 PM
It's amusing to me that googling this issue led to an almost identical question on the old forums: http://www.python-forum.org/viewtopic.php?f=12&t=17418
Larz60+ Wrote:Hello, Anti-aliasing is disabled by default (or at least used to be). Do you have some code we can run to verify the issue?
Aug-11-2017, 07:05 PM
from tkinter import *
from tkinter import ttk
root = Tk()
root.overrideredirect(True)
root.geometry('+1000+500')
root.lift()
root.wm_attributes('-topmost', True)
root.wm_attributes('-disabled', True)
root.wm_attributes('-transparentcolor', 'white')
label = Label(root, text='test', bg='white')
label.pack()
root.mainloopThe letters are surrounded by white, reducing readability at small size and in front of the wrong colour.
Aug-11-2017, 07:54 PM
I'm not sure there's a way to disable whether or not a font is antialiased, but you can at least use a font that just doesn't have it. This worked for me (I commented out a few things to make testing easier):
from tkinter import *
from tkinter import ttk
root = Tk()
# root.overrideredirect(True)
root.geometry('+1000+500')
# root.lift()
root.wm_attributes('-topmost', True)
#root.wm_attributes('-disabled', True)
root.wm_attributes('-transparentcolor', 'white')
label = Label(root, text='test', bg='white', font="fixedsys")
label.pack()
root.mainloop()
|
|
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| [Tkinter] binding versus disable | DPaul | 6 | 12,410 |
May-05-2021, 05:17 PM Last Post: DPaul |
|
| How to disable custom button | Sancho_Pansa | 7 | 7,212 |
Dec-04-2020, 02:21 PM Last Post: buran |
|
| How to disable focus on Frame in Tkinter? | szafranji | 1 | 4,745 |
May-13-2020, 10:45 PM Last Post: DT2000 |
|
| Disable entry field and still see value | scratchmyhead | 5 | 8,803 |
May-11-2020, 08:09 PM Last Post: menator01 |
|
| [Tkinter] how can disable menu [About] when Toplevel is active | balenaucigasa | 0 | 3,944 |
Oct-25-2019, 09:49 PM Last Post: balenaucigasa |
|
| Disable Enter Key PyQt5 Wizard | maffaz | 1 | 8,389 |
Jul-02-2018, 09:45 AM Last Post: maffaz |
|