goreviewpartner icon indicating copy to clipboard operation
goreviewpartner copied to clipboard

GUI scaling for hi-dpi displays

Open fishcu opened this issue 6 years ago • 10 comments

With the current libraries used for GUI display, is it possible to add a setting to scale the GUI by a factor of 1.25, 1.5, ..., 2, etc.? On my screen, under Ubuntu 16.04, everything GUI-related looks tiny and hard to navigate.

Thank you for providing this software!

fishcu avatar Nov 21 '17 14:11 fishcu

Here's a screenshot. The titlebar of the window and the title look normal size on my display.

goreviewpartner_gui

EDIT: comparing with screenshots on the documentation page, the font size is also wrong (or maybe correct, but it doesn't fit with the overall scaling).

fishcu avatar Nov 21 '17 15:11 fishcu

Hi! Ok, now I understand why the coordinates appear so big on you screenshot!

There must be a way to tell tkinter to adjust, I will look into it.

pnprog avatar Jan 11 '18 02:01 pnprog

Hi @fishcu,

Would you try this method and tell me if it does the trick? Edit the file main.py, and below line 36 app = Tk() insert those 3 lines:

dpi_value = app.winfo_fpixels('1i')
log("Screen DPI:",dpi_value)
app.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0)

Then launch the main.py file with python again.

pnprog avatar Jan 11 '18 03:01 pnprog

The resulting display is the same (everything looks the same as before).

The reported DPI is: "Screen DPI: 96.047267356"

I'm on a 14" display, with a 2560x1440 resolution. https://www.sven.de/dpi/ calculates this as around 210 PPI.

fishcu avatar Jan 11 '18 10:01 fishcu

Ok, then the detection of proper DPI does not work. Then can try replacing those 3 lines by those 2 lines and see if it works for you?

dpi_value = 210
app.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0)

If that works (of if it improves the interface) then I will make it possible to adjust this values manually in the settings.

pnprog avatar Jan 11 '18 16:01 pnprog

To avoid doing the same work twice: I'm currently working on a fix for this issue. I might come up with something this week. :)

fishcu avatar Jan 14 '18 17:01 fishcu

Great!

pnprog avatar Jan 15 '18 05:01 pnprog

@fishcu , I just pushed a commit that aims at a better adjusting of the size of marking (A, B, C, 1, 2, 3...) on the Goban. Because I noticed on all your screen-shots that the letters/numbers are bigger than the circles/stones. I am now making a sort of measurement to get the ratio fontsize/pixel (which appears to be linear) then calculate the font size so that it correspond to 0.7 of one intersection.

Also, the circles containing those letters have width adjusted based on goban size in pixel (same as the 19 lines), so they will appear larger than 1px on high resolution screen like your. And so hopefully more visible.

Could you have a try and let me know if it's working?

pnprog avatar Feb 17 '18 14:02 pnprog

Hi @pnprog

Got extremely busy the last few weeks. Sorry I didn't hold my promise ;) I will test your update soon when the chance arises. Thanks for the support!

fishcu avatar Feb 25 '18 21:02 fishcu

I noticed that in the current version, while most GUI elements are still very small, the Goban and the coordinates are rendered correctly on hi-dpi screens. Great!

fishcu avatar May 10 '18 19:05 fishcu