Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/mouseinfo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# by copying the code for the position() and screenshot() functions into this
# source code file.
import datetime, subprocess

import platform
try:
from PIL import Image
_PILLOW_INSTALLED = True
Expand Down Expand Up @@ -188,22 +188,28 @@ def _linuxGetPixel(x, y):

RUNNING_PYTHON_2 = sys.version_info[0] == 2

cond==platform.platform().split('-')[3]=='MANJARO'
EXIT_MSG='NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: '
if cond:
EXIT_MSG='pacman -S tk'
else:
EXIT_MSG='sudo apt-get install python-tk python-dev'
if platform.system() == 'Linux':
if RUNNING_PYTHON_2:
try:
import Tkinter as tkinter
ttk = tkinter
from Tkinter import Event
except ImportError:
sys.exit('NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python-tk python-dev')
sys.exit(EXIT_MSG)
else:
# Running Python 3+:
try:
import tkinter
from tkinter import ttk
from tkinter import Event
except ImportError:
sys.exit('NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python3-tk python3-dev')
sys.exit(EXIT_MSG)
else:
# Running Windows or macOS:
if RUNNING_PYTHON_2:
Expand Down