CSSG-Labs / PyNote

Text Editor Written in Python
GNU General Public License v3.0
3 stars 4 forks source link

Fix Display Error When Using WSL/Linux #3

Closed PatrickBruso closed 2 years ago

PatrickBruso commented 2 years ago

Although the code runs on Windows and MacOS, when run on WSL (Windows Subsystem for Linux) the following error is called: _tkinter.TclError: no display name and no $DISPLAY environment variable

We need to figure out why this error is happening on Linux based systems and how to fix it. I believe this is an issue with the DISPLAY environment variable and some research suggests solutions to either have the user set their DISPLAY value manually or add code that will check for a DISPLAY value and, if not found, add one. See here for a potential solution.

AdamLaine commented 2 years ago

@PatrickBruso I've performed a small experiment and may be able to answer your doubts. I've tested it on Linux and it worked perfectly (the same as on Win10), so we may conclude that on the configured Linux (i.e. not bare-bones GUI-less Arch, Void or Gentoo) it works fine. Though the WSL problem remains. From my knowledge and experience Linux requires a display server (see, for example, Xorg https://wiki.archlinux.org/title/Xorg) and a desktop environment (see, for example, GNOME https://www.gnome.org/) to display GUI applications, both of which are absent in the WSL (obviously the desktop environment is and I can guess that the display server too), at least I can speak of the Win10 one, I haven't used Win11 WSL, but I've read from the documentation (https://docs.microsoft.com/en-us/windows/wsl/tutorials/gui-apps) that in Win11 Microsoft resolved this issue. There is, although, this guide, which I have found and quickly read (https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242) I don't know if it works and I'll tell you honestly I will prefer not to test it, but basically he installs via some software the above mentioned stuff. At this point, in my opinion, it doesn't worth the time, especially provided that as I said on general Linux it works the same as on Windows. I hope it helped

AdamLaine commented 2 years ago

My apologies, mouseslip

PatrickBruso commented 2 years ago

I agree. I also looked into it further since I posted this issue and it seems to be an issue with WSL2 on Win 10. I also have been told that running WSL2 on Win 11 fixes this issue. Unfortunately, I cannot test as my system is not eligible for upgrade to Win11. So, I think we've done all we can here, and obviously instituting a fix for WSL2 on Win10 is way out of our abilities.