# start editor and/or shell windows:
root = Tk(className="Idle")
root.withdraw()
+ from idlelib.run import fix_scaling
+ fix_scaling(root)
# set application icon
icondir = os.path.join(os.path.dirname(__file__), 'Icons')
import Tkinter
import tkMessageBox
root = Tkinter.Tk()
+ fix_scaling(root)
root.withdraw()
if err.args[0] == 61: # connection refused
msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\
capture_warnings(False)
sys.exit(0)
+
+def fix_scaling(root):
+ """Scale fonts on HiDPI displays."""
+ import tkFont
+ scaling = float(root.tk.call('tk', 'scaling'))
+ if scaling > 1.4:
+ for name in tkFont.names(root):
+ font = tkFont.Font(root=root, name=name, exists=True)
+ size = int(font['size'])
+ if size < 0:
+ font['size'] = int(round(-0.75*size))
+
+
class MyRPCServer(rpc.RPCServer):
def handle_error(self, request, client_address):