Skip to content

Commit

Permalink
GUI Update - Fixed Windows/MacOS bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kmishra9 committed Jan 11, 2017
1 parent 0df44b2 commit cab196a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,18 @@ def __call__(self):
import msvcrt
return msvcrt.getch()

#Check if the environment is GUI-runnable (no import error, Display available to output to) OR if only CLI is supported
#Check if the environment is GUI-runnable (no import error, GUI is able to initialize) OR if only CLI is supported
if GUI_runnable == None:
GUI_runnable = "DISPLAY" in os.environ

if GUI_runnable:
root = Tk()
gui = gui_2048(root)

try:
root = Tk()
gui = gui_2048(root)
GUI_runnable = True
except:
GUI_runnable = False

if getch == None:
getch = _Getch()


#End of utils.py
#End of utils.py

0 comments on commit cab196a

Please sign in to comment.