TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.58k stars 1.08k forks source link

Rendering font file cannot be loaded in conda environment #300

Open scott-ca opened 2 years ago

scott-ca commented 2 years ago

I am tried out the various examples and seem to consistently get distorted borders as shown below. It almost appears as if it isn't filing out the buttons properly. However, I noticed even on the check boxes there is a lot of distortion even on the straight portions of the check box.

I have tested this in a fresh conda environment with just the required packages along with Python 3.10.4 and still encounter the issue. In case it matters, I am using this on Linux.

It almost feels as if it would be a display/resolution setting on my computer, however I have tried various different settings within the settings panel as well as multiple monitors without any success.

Lastly, I did want to add when I am using the standard tkinter I don't notice any of these issues, so maybe it is an issue with the drawing module conflicting with something I have?

Have you seen this before, and if so does it look to be an issue with a conflicting package that I might be using or something maybe display setting related that I am maybe missing?

image

TomSchimansky commented 2 years ago

Which Linux version are you using? To render the widgets I'm using fonts, which need to be loaded from a .otf file. One Linux I do this by copying the .otf font file into the folder '~/.fonts/', and normally then they can be used in tkinter. But that's not working for you for some reason. Can you check if the fonts folder exists and if there's a font named CustomTkinter_shapes_font.otf in there?

scott-ca commented 2 years ago

I am using popOS 22.04 LTS. In case it matters popOS is based off of Ubuntu.

I do have fonts folder. I am not sure what was all there before, but I have a four files. I have CustomTkinter_shapes_font.otf, Roboto-Medium.ttf, Roboto-Regular.ttf, .uuid.

I just tested removing all the files from the folder and then re-installing the module. When I launched the example for the first time it re-added the 3 files to the folder.

I guess it shouldn't be an access issue since it's able to put the files there in the first place when I run it. In case it matters, I am using this from a conda environment.

I did also try going into fonts and finding the font and clicking install. That copied it to .local/share. That didn't seem to yield any results, I didn't log out and back in after doing so. I can try that if think it may help.

Is there anything I can set manually in the OS to test to see if it resolves the issue that may help narrow down where the problem may be occurring?

gauravguptabits commented 2 years ago

I am observing this issue too and I am on Ubuntu 20.04 and using conda environment.

Note: Switching from conda to virtual environment fixed the issue for me. So, looks like custom tinker is trying to look some of the configuration or soft dependencies whose lookup is not compatible to conda.

scott-ca commented 2 years ago

Good find on switching to a non-conda environment fixing the issue.

Interesting that it can put the files into folder, but isn't able to read them. I have done some initial digging and it looks like it may have come up before within tkinter directly with fonts as shown in the link below.

https://github.com/ContinuumIO/anaconda-issues/issues/6833

I will do some more digging and see if I can find anything that allows you to access the fonts from the environment and/or if the fonts can be installed with the conda environment some how.

felipetesc commented 2 years ago

I am observing this issue too and I am on Ubuntu 20.04 and using conda environment.

Note: Switching from conda to virtual environment fixed the issue for me. So, looks like custom tinker is trying to look some of the configuration or soft dependencies whose lookup is not compatible to conda.

Same thing