Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 votes

Hello all! I just found out that due to some of my hardware, that the window size provided for Lab 8 is too small and compact and creates a really small window with overlapping boxes and letters. I already know the fix I had to make for this without changing the window size in the lab, but wanted to see if anyone knows how to fix it or was having the same issues! I'll let you know if your answer matches what I did or if it works or not as well!

asked in CSC201 Spring 2021 by (1 point)
+1

I was having the same issue. It's good to know that other people are having this issue too! I honestly have no idea how to fix it but thanks for asking for me!

1 Answer

+4 votes
 
Best answer

Interesting. I have this problem too. I suspect it's due to having a high-resolution / HiDPI screen, which is using a scaling factor for drawing most windows/etc. I thought it might be a Linux issue, so I wasn't really worried about it, but it sounds like it's affecting some Windows machines too, so I should probably try to look into it and see if there's a way to fix our textbook author's graphics library.

One workaround for me is just to make all of the font sizes be half as big, but then the fonts will all look too small on someone else's computer!

To help me debug this, can you run the following commands in Thonny, and paste back what it prints, as a comment?

import tkinter as tk
root = tk.Tk()
print("scaling:", root.call('tk','scaling'))
font = tk.font.Font(family="Courier",size=100,weight="normal")
print("Measure:", font.measure('A'))

Also, what is your screen resolution ("Display Settings" under the Windows settings/control panel)? Also, under the "Display Settings", do you see anything about "Scale" or "Scaling"/ If so, is it 100% or something else?

answered by (5.7k points)
selected by
+1

This is what gets displayed when I run the code in Thonny:

scaling: 2.997050147492625
Measure: 180

And to answer your question, my laptop's resolution is overkill at 4k. So, depending on whether I have the resolution set to 4k and depending on the scaling, the box will be really small with the boxes and words overlapping.

So in order to fix the scaling issue, I just did it the easy way and set my screen resolution down to 1080p.

+2

Can you run that code I gave you again, but this time run it when your screen resolution is set at 1080p, and give me the numbers then? Maybe try it once at an even lower resolution too...

+1

At 1080p:
scaling: 1.3333333333333333
Measure: 80

At 720p:
scaling: 1.3320222877745
Measure: 80

...