jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 68 forks source link

Unknown platform: CYGWIN_NT-10.0-WOW #537

Open sharuzzaman opened 5 years ago

sharuzzaman commented 5 years ago

Bug Report


Context


I'm testing appJar with Python in Cygwin

Expected Behaviour


appJar should run

Actual Behaviour


appJar does not run

Any error messages produced by appJar


$ ./main.py Traceback (most recent call last): File "./main.py", line 6, in app = gui() File "/cygdrive/c/Users/sharuzzr/Downloads/app/appJar/appjar.py", line 438, in init self.platform = gui.GET_PLATFORM() File "/cygdrive/c/Users/sharuzzr/Downloads/app/appJar/appjar.py", line 265, in GET_PLATFORM raise Exception("Unknown platform: " + platform()) Exception: Unknown platform: CYGWIN_NT-10.0-WOW

Sample code, demonstrating the issue


$ cat main.py

!/bin/env python

import the library

from appJar import gui

create a GUI variable called app

app = gui()

What steps are needed to reproduce the bug


  1. Install Cygwin
  2. Install Python 2.7 package in Cygwin
  3. Create main.py like above
  4. ./main.py

Version Information


$ python main.py -v appJar: 0.93.0 Python: 2.7.14 TCL: 8.6, TK: 8.6 Platform: CYGWIN_NT-10.0-WOW pid: 16036 locale: en_US

jarvisteach commented 5 years ago

Hi @sharuzzaman - thanks for raising this.

There are lots of platform specific sections inside appJar, trying to keep the same functionality across MAC/WINDOWS/LINUX - so, the first thing appJar does, is determine a platform.

I've not really come across CYGWIN before - I've just googled it, and it looks like a "linux emulator" running inside Windows.

So, if appJar finds CYGWIN I'll configure it to set Windows as the platform, I'm assuming all the Windows functionality will still be available?

sharuzzaman commented 5 years ago

So, if appJar finds CYGWIN I'll configure it to set Windows as the platform, I'm assuming all the Windows functionality will still be available?

Not really. Cygwin tries to map Linux/Unix API call to Windows equivalent using an emulated library. From Unix application point of view after being compiled in Cygwin, it is a Linux application. So I believe Cygwin should be best under Linux family, but some features might not be 100% available for Cygwin application.

I have tried to put Cygwin under Linux platform, but the code returns nothing.

@staticmethod def GET_PLATFORM(): """ returns one of the gui class's three static platform variables """ if platform() in ["win32", "Windows"]: return gui.WINDOWS elif platform() == "Darwin": return gui.MAC elif platform() in ["Linux", "FreeBSD","CYGWIN_NT-10.0-WOW"]: return gui.LINUX else: raise Exception("Unknown platform: " + platform())

sharuzzr@laptop /cygdrive/C/Users/sharuzzr/Downloads/app $ ./main.py Traceback (most recent call last): File "./main.py", line 6, in app = gui() File "/cygdrive/C/Users/sharuzzr/Downloads/app/appJar/appjar.py", line 533, in init self.topLevel = Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1819, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

sharuzzr@laptop /cygdrive/C/Users/sharuzzr/Downloads/app $ export DISPLAY=:0

sharuzzr@laptop /cygdrive/C/Users/sharuzzr/Downloads/app $ ./main.py

changing the return to gui.WINDOWS also show nothing

I think this might be related to Tk library as well. Maybe Cygwin should use Tk in Cygwin rather than Tk in Windows or Linux

jarvisteach commented 5 years ago

Difficult one, I don't have an environment right now where I can test this.

But the fix would have been to either have GET_PLATFORM() return gui.LINUX' or 'gui.WINDOWS

If both of those fail, then it's going to be a bigger problem!

jarvisteach commented 5 years ago

I've had a quick google, and found the following site: https://daddyathouse76.wordpress.com/2017/06/10/python-gui-on-cygwin/

Are you running an X server within CYGWIN? If not, that'll explain the no display error...

jarvisteach commented 5 years ago

Hi @sharuzzaman - I was wondering if this had given you any help?