3

I have trawled the net and can't seem to find a satisfactory answer. Whenever I run a program that has a Tkinter GUI it always seems blurry/fuzzy (which I assume is a low resolution). It seems much lower resolution than the Windows 10 OS that is running on a couple of computers that I run these programs on.

It doesn't matter what program I run I still get the same results for all types of Tkinter entities such as buttons, labels, file dialogues etc. Which is why I have not included a sample of code.

I have copied some examples below:

Tkinter FD

Tkinter Label

Is this something I should just expect or is there some of setting on the OS\Python\Tkinter that I need to alter.

Any help would be very much appreciated.

  • I have tried this on another Windows 10 computer and the output is fine. The other computer is just a very basic Minix z64. I am wondering if it is because the other two computers have a graphics card, but any help would be much appreciated. – SilverMerlin Apr 16 '16 at 08:12

3 Answers3

5

It seems to be an OS tweak. I don't know the details (would be glad for an explanataion), but it does the job on Windows 10:

ctypes.windll.shcore.SetProcessDpiAwareness(1)

Call it before you initiate your GUI, i.e.:

import ctypes
.
.
.
if __name__ == "__main__":   
    if 'win' in sys.platform:
        ctypes.windll.shcore.SetProcessDpiAwareness(1)

    [call your Tkinter stuff]

Got it from here:

Attempting to resolve blurred tkinter text + scaling on Windows 10 high DPI displays, but concerned my approach is not Pythonic or is unsafe

Community
  • 1
  • 1
Jay
  • 2,535
  • 3
  • 32
  • 44
0

I too had the same problem. I fixed it by disabling display scaling on high DPI settings on python.exe and pythonw.exe.

I followed the instructions on this page: http://www.thewindowsclub.com/fonts-appear-blurred-windows-8

1) Open your Python installation directory, this should be C:\Python27\

2) Find a executable file called python.exe

3) Right click it, and select properties

4) Go to the compatibility tab, and check Disable display scaling on high DPI settings

5) Repeat for pythonw.exe

This should fix your issues with blurry fonts

Mintd
  • 1
  • 1
  • 1
0

I was able so solve it! I had a look on this question: on Stackoverflow The answer from @Jay solved my problem completely. So it was not really a tkinter/python thing, but rather windows itself.

Poleyn
  • 1
  • 1
  • 3