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.
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", "*.*"))
)
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","*.*")))
I finally found the answer. You just have to import the pyautogui
module into program.
import pyautogui
Use:
from pyscreeze import pixel
Or on Windows:
import sys
if sys.platform == 'win32':
import ctypes
try:
ctypes.windll.user32.SetProcessDPIAware()
except AttributeError:
pass
In this picture you can see that the left dialog has a lower resolution then then right one.
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", "*.*"))
)
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","*.*")))
I finally found the answer. You just have to import the pyautogui
module into program.
import pyautogui
Use:
from pyscreeze import pixel
Or on Windows:
import sys
if sys.platform == 'win32':
import ctypes
try:
ctypes.windll.user32.SetProcessDPIAware()
except AttributeError:
pass