Skip to content

Commit 7618e80

Browse files
committed
fix high resolution (dpi) screenshot problems
1 parent c479670 commit 7618e80

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import tkinter as tk
22
import canvas # canvas wrapper widget
33
import predictions_ui
4-
from network import Network
4+
import network
5+
import os
6+
if os.name == 'nt':
7+
# if on Windows, disable highDPI scaling which ruins Pillow's ScreenGrab
8+
from ctypes import windll
9+
windll.shcore.SetProcessDpiAwareness(1)
510

611

712
class App(tk.Tk):
@@ -12,7 +17,7 @@ def __init__(self, parent):
1217
self.resizable(0, 0) # prevent resizing
1318
self.after(250, self.center) # center window after window has become visible
1419

15-
self.net = Network([784, 30, 10])
20+
self.net = network.Network([784, 30, 10])
1621
self.net.load_wb() # load weights and biases for neural network form pkl file
1722
self.res = None # results widget
1823
self.cnv = None # canvas widget

0 commit comments

Comments
 (0)