-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work in WSL because tkinter is required #5
Comments
Interesting. I didn't try WSL, just Linux (x86 and Arm), Windows and Mac. I know nothing of WSL, but presumably installing tkinter library is not a possibility if there is no GUI. Will have a think. |
WSL does not support GUI's at all yet. Microsoft plan to add this feature in the future. If you are going to want to use a GUI then you are going to need to run it on windows itself by installing python. |
Had a quick investigate, and can conditionally import, so will sort that out on Monday. |
After a quick google i was able to find out that you can install tkinter using: |
Ok so far I have had no issues after insalling the module. Looks like that has appeared to fix the issue @nmk456 . |
I'll still fix it up, shouldn't need tkinter installed if only running from the command line. |
Hmm, bit more of a PITA that initially thought. Without TKInter a load of top level classes break the rest of the code as tk is undefined. Will need to swot up a bit more on Python and imports etc. |
am i correct in thinking tkinter is only needed for loading the gui? |
If so then can you just use an if statement to import the tkinter module only when the gui option is called? |
Ok this is a bit messy and definatly is not the neatest solution. but i have thrown together a "patch" based on my comment/thought before that basically only imports and runs code that needs tkinter when the --gui or -g option is called. SHA-256: E6F5CD91BD23A4895175F5BDEEDD540B2075C339C32B8E64CC7EC4C646C78780 I hope this is somewhat useful! EDIT: Oh btw i tested this on windows (normal python install with tkinter) and WSL with the tkinter module uninstalled. |
I was trying something along those lines. The mass movement of classes is a PITA. Will do something similar and try and maintain some semblance of code sanity! |
Note, also need to surround the TK import in try catch because you still need to catch people asking for a GUI when its not supported. |
Ok so I have done a massive restructure of the code... It took a while. Nothing has changed only how the code is stored and how different things are called. The restructure allows for the program to work fine without tkinter without a GUI. |
Oh while i remember i forgot to add this into my code. but it shouldn't matter too much because if they are trying to run a gui in an environment that does not have one installed or supported then that will be the only time the program crashes. |
I'll take a look as son as I can, I suspect a change this large will need a loot of checking over, but its along the lines I was thinking of, so useful. Not how how splitting it up will affects its running in all circumstances. |
Oh yeah i agree a change that massive will needs lots of looking over! It wont necessarily affect the running in most circumstances but it will make the code easier to maintain and having the settings inside one file makes changing them a little easier. |
Just so most of us are going to use WSL for development, I would like to add my contribution in closing this issue.
|
I don't know where you got that idea? We (Raspberry Pi) don't provide any instructions for Pico development using WSL, and therefore we don't officially support it. But if you want to use it, and it works for you, then great 👍 🙂 |
Looks that the |
Could the library tkinter be loaded only in GUI mode? It does not bring any value in CLI mode. |
Running pico_project.py in WSL fails because there's no GUI and therefore no tkinter module. This could be fixed perhaps by only importing tkinter if pico_project.py is run with the GUI option.
The text was updated successfully, but these errors were encountered: