Update DPI settings

This commit is contained in:
Evan Su 2021-03-13 12:56:27 -05:00 committed by GitHub
parent bf29277b92
commit 37d6bfdc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 9 deletions

View File

@ -32,10 +32,11 @@ import tkinter.ttk
import tkinter.scrolledtext import tkinter.scrolledtext
import webbrowser import webbrowser
# Set high DPI on Windows # Tk/Tcl is a little barbaric, disable
# high DPI so it doesn't look really ugly
try: try:
from ctypes import windll from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1) windll.shcore.SetProcessDpiAwareness(0)
except: except:
pass pass
@ -60,18 +61,11 @@ unknownErrorNotice = "Unknown error occured. Please try again."
# Create root Tk # Create root Tk
tk = tkinter.Tk() tk = tkinter.Tk()
#tk.tk.call('tk', 'scaling', 2.0)
tk.geometry("480x420") tk.geometry("480x420")
tk.title("Picocrypt") tk.title("Picocrypt")
tk.configure(background="#f5f6f7") tk.configure(background="#f5f6f7")
tk.resizable(0,0) tk.resizable(0,0)
try:
dpi = windll.user32.GetDpiForWindow(tk.winfo_id())
tk.tk.call("tk","scaling",dpi/72.0)
except:
pass
# Try setting image if included with Picocrypt # Try setting image if included with Picocrypt
try: try:
favicon = tkinter.PhotoImage(file="./key.png") favicon = tkinter.PhotoImage(file="./key.png")