Why tkinter ask open file has a low resolution?

Question:

In this picture you can see that the left dialog has a lower resolution then then right one.

enter image description here

Why folders are different?

I’m working with Python 3 and here’s my code

from tkinter.filedialog import askopenfilename

askopenfilename(
    initialdir = "/",
    title = "Select a File",
    filetypes = (("Text files", "*.txt*"), ("all files", "*.*"))
)
Asked By: Frost Dream

||

Answers:

The only way is using the call() function to change the resolution scaling.

from tkinter.filedialog import askopenfilename
import tkinter as tk
 
root = tk.Tk()
root.geometry("200x150")
root.tk.call('tk', 'scaling', 2.0)

askopenfilename(initialdir = "/",title = "Select a File",filetypes = (("Text files","*.txt*"),("all files","*.*")))
Answered By: toyota Supra

I finally found the answer. You just have to import the pyautogui module into program.

import pyautogui
Answered By: Frost Dream

Use:

from pyscreeze import pixel

Or on Windows:

import sys

if sys.platform == 'win32':
    import ctypes
    try:
       ctypes.windll.user32.SetProcessDPIAware()
    except AttributeError:
        pass
Answered By: ole
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.